From c724e024cea9edc7d5c7d05c60223206e5f4f2dc Mon Sep 17 00:00:00 2001 From: whitequark Date: Wed, 15 Jul 2015 06:33:44 +0300 Subject: [PATCH] Fix inference for multiple-target assignments. --- artiq/compiler/transforms/inferencer.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/artiq/compiler/transforms/inferencer.py b/artiq/compiler/transforms/inferencer.py index c06453601..869b87340 100644 --- a/artiq/compiler/transforms/inferencer.py +++ b/artiq/compiler/transforms/inferencer.py @@ -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)