From 56e14bfac743af5b8a3aa5cb08cb74a4f1d17f4f Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Sun, 31 Mar 2019 02:16:17 +0100 Subject: [PATCH] compiler: Fix comparison of tuples of lists --- artiq/compiler/transforms/artiq_ir_generator.py | 2 +- artiq/test/lit/integration/tuple.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/artiq/compiler/transforms/artiq_ir_generator.py b/artiq/compiler/transforms/artiq_ir_generator.py index 97822feed..b30c5d202 100644 --- a/artiq/compiler/transforms/artiq_ir_generator.py +++ b/artiq/compiler/transforms/artiq_ir_generator.py @@ -1426,7 +1426,7 @@ class ARTIQIRGenerator(algorithm.Visitor): for index in range(len(lhs.type.elts)): lhs_elt = self.append(ir.GetAttr(lhs, index)) rhs_elt = self.append(ir.GetAttr(rhs, index)) - elt_result = self.append(ir.Compare(op, lhs_elt, rhs_elt)) + elt_result = self.polymorphic_compare_pair(op, lhs_elt, rhs_elt) if result is None: result = elt_result else: diff --git a/artiq/test/lit/integration/tuple.py b/artiq/test/lit/integration/tuple.py index 5d6c153dd..44564c151 100644 --- a/artiq/test/lit/integration/tuple.py +++ b/artiq/test/lit/integration/tuple.py @@ -5,3 +5,9 @@ x, y = 2, 1 x, y = y, x assert x == 1 and y == 2 assert (1, 2) + (3.0,) == (1, 2, 3.0) + +assert (0,) == (0,) +assert (0,) != (1,) + +assert ([0],) == ([0],) +assert ([0],) != ([1],)