2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 11:18:27 +08:00

transforms.inferencer: do not unnecessarily mutate typedtree.

This caused the hash to change after every iteration of inference,
if the result of any coercion was an integer of indefinite width.
This commit is contained in:
whitequark 2017-03-02 16:15:37 +00:00 committed by Sebastien Bourdeauducq
parent 007ae00459
commit 90aeb76a2c

View File

@ -293,7 +293,8 @@ class Inferencer(algorithm.Visitor):
return coerced_node return coerced_node
elif isinstance(coerced_node, asttyped.CoerceT): elif isinstance(coerced_node, asttyped.CoerceT):
node = coerced_node node = coerced_node
node.type, node.other_value = typ, other_node node.type.unify(typ)
node.other_value = other_node
else: else:
node = asttyped.CoerceT(type=typ, value=coerced_node, other_value=other_node, node = asttyped.CoerceT(type=typ, value=coerced_node, other_value=other_node,
loc=coerced_node.loc) loc=coerced_node.loc)