forked from M-Labs/artiq
1
0
Fork 0

Fix inference for multiple-target assignments.

This commit is contained in:
whitequark 2015-07-15 06:33:44 +03:00
parent 9ff9f85f19
commit c724e024ce
1 changed files with 3 additions and 6 deletions

View File

@ -652,12 +652,9 @@ class Inferencer(algorithm.Visitor):
def visit_Assign(self, node):
self.generic_visit(node)
if len(node.targets) > 1:
self._unify(types.TTuple([x.type for x in node.targets]), node.value.type,
node.targets[0].loc.join(node.targets[-1].loc), node.value.loc)
else:
self._unify(node.targets[0].type, node.value.type,
node.targets[0].loc, node.value.loc)
for target in node.targets:
self._unify(target.type, node.value.type,
target.loc, node.value.loc)
def visit_AugAssign(self, node):
self.generic_visit(node)