Commit 42db5e4d authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add semantic test when using the append operator

parent 9d05f204
......@@ -1436,7 +1436,7 @@ def append_expression(root, context):
''' Append expression analysis '''
expr, errors, warnings = binary_expression(root, context)
left = find_basic_type(expr.left.exprType)
left = find_basic_type(expr.left.exprType)
right = find_basic_type(expr.right.exprType)
# check that the appended value is of the right type
......@@ -1446,12 +1446,21 @@ def append_expression(root, context):
# except TypeError as err:
# errors.append(error(root, str(err)))
# check that both left and right are actual strings
for bty in (left, right):
if bty.kind != 'SequenceOfType' and not is_string(bty):
msg = 'Append can only be applied to types SequenceOf or String'
errors.append(error(root, msg))
warnings.extend(compare_types(left.type, right.type))
except TypeError as err:
errors.append(error(root, str(err)))
except AttributeError:
# The above only applies to Sequence of, not strings
attrs = {'Min': str(int(right.Min) + int(left.Min)),
'Max': str(int(right.Max) + int(left.Max))}
# It is wrong to set the type as inheriting from the left side FIXME
......@@ -7,9 +7,9 @@ opengeode --shared
cat dataview.asn >> dataview-uniq.asn
asn1.exe -Ada -typePrefix asn1Scc -equal dataview.asn
asn1.exe -c -typePrefix asn1Scc -equal dataview.asn
gnatmake -gnat2012 -c *.adb
gnatmake -gnat2012 -fPIC -c *.adb
gnatbind -n -Llibtestsc testsc
gnatmake -c -gnat2012 b~testsc.adb
gnatmake -c -fPIC -gnat2012 b~testsc.adb
gcc -shared -fPIC -o b~testsc.o testsc.o ccsdssoissubnetwork.o ccsdssoissubnetworkinterfaces.o demo.o demointerfaces.o environment.o environmentinterfaces.o adaasn1rtl.o -lgnat
rm -f dataview-uniq.c dataview-uniq.h
asn2aadlPlus dataview-uniq.asn DataView.aadl
Supports Markdown
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