Commit 1e348f19 authored by Maxime Perrotin's avatar Maxime Perrotin

Fix type check in substrings

parent 4bafdc70
......@@ -134,6 +134,9 @@ The background pattern was downloaded from www.subtlepatterns.com
Changelog
=========
2.0.27 (03/2019)
- Fix type checking when using substrings
2.0.26 (03/2019)
- minor bugfix with underscore/dash confusion
......
......@@ -2098,10 +2098,23 @@ def primary_substring(root, context):
if receiver_bty.kind == 'SequenceOfType' or \
receiver_bty.kind.endswith('StringType'):
# min0/max0 and min1/max1 are the values of the substring bounds
min0 = float(find_basic_type(params[0].exprType).Min)
min1 = float(find_basic_type(params[1].exprType).Min)
max0 = float(find_basic_type(params[0].exprType).Max)
max1 = float(find_basic_type(params[1].exprType).Max)
try:
min0 = float(find_basic_type(params[0].exprType).Min)
max0 = float(find_basic_type(params[0].exprType).Max)
except AttributeError as err:
msg = 'First parameter of substring: could not resolve type'
errors.append(error(root, msg))
LOG.debug('In primary_substring: ' + str(err))
min0, max0 = 0, 0
try:
min1 = float(find_basic_type(params[1].exprType).Min)
max1 = float(find_basic_type(params[1].exprType).Max)
except AttributeError as err:
msg = 'Second parameter of substring: could not resolve type'
errors.append(error(root, msg))
LOG.debug('In primary_substring: ' + str(err))
min1, max1 = 0, 0
node.exprType = type('SubStr', (receiver_bty,),
{'Min': str(int(min1) - int(max0) + 1),
'Max': str(int(max1) - int(min0) + 1)})
......
......@@ -141,7 +141,7 @@ except ImportError:
__all__ = ['opengeode', 'SDL_Scene', 'SDL_View', 'parse']
__version__ = '2.0.26'
__version__ = '2.0.27'
if hasattr(sys, 'frozen'):
# Detect if we are running on Windows (py2exe-generated)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment