Commit 5917b885 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Fixes in type checkings

parent 722f1b37
...@@ -1862,6 +1862,7 @@ def _assign_expression(expr): ...@@ -1862,6 +1862,7 @@ def _assign_expression(expr):
strings = [] strings = []
left_stmts, left_str, left_local = expression(expr.left) left_stmts, left_str, left_local = expression(expr.left)
right_stmts, right_str, right_local = expression(expr.right) right_stmts, right_str, right_local = expression(expr.right)
# If left side is a string/seqOf and right side is a substring, we must # If left side is a string/seqOf and right side is a substring, we must
# assign the .Data and .Length parts properly # assign the .Data and .Length parts properly
basic_left = find_basic_type(expr.left.exprType) basic_left = find_basic_type(expr.left.exprType)
...@@ -1893,6 +1894,10 @@ def _assign_expression(expr): ...@@ -1893,6 +1894,10 @@ def _assign_expression(expr):
strings.append(u"{lvar}.Length := {rlen};" strings.append(u"{lvar}.Length := {rlen};"
.format(lvar=left_str, rlen=rlen)) .format(lvar=left_str, rlen=rlen))
elif basic_left.kind.startswith('Integer'): elif basic_left.kind.startswith('Integer'):
print '\nASSIGN:', expr.inputString
print " Left type = ",type_name(find_basic_type (expr.left.exprType))
print " Right type = ",type_name(find_basic_type (expr.right.exprType))
# Make sure that integers are cast to 64 bits # Make sure that integers are cast to 64 bits
# It is possible that left and right are of different types # It is possible that left and right are of different types
# (signed vs unsigned and/or 32bits vs 64 bits). # (signed vs unsigned and/or 32bits vs 64 bits).
......
...@@ -4175,7 +4175,9 @@ def assign(root, context): ...@@ -4175,7 +4175,9 @@ def assign(root, context):
and expr.right.value[0] in ('abs', 'length'): and expr.right.value[0] in ('abs', 'length'):
pass pass
else: else:
expr.right.exprType = expr.left.exprType basic_right = find_basic_type(expr.right.exprType)
if not basic_right.kind.startswith('Integer'):
expr.right.exprType = expr.left.exprType
# XXX I don't understand why we don't set the type of right # XXX I don't understand why we don't set the type of right
# to the same value as left in case of ExprAppend # to the same value as left in case of ExprAppend
# Setting it - I did not see any place in the Ada backend where # Setting it - I did not see any place in the Ada backend where
......
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