From 7406a1f9839339ee617a6f402eb2fc7a26ba785c Mon Sep 17 00:00:00 2001 From: pca006132 Date: Thu, 8 Oct 2020 19:14:05 +0800 Subject: [PATCH] compiler: error message for custom operations Emit error messages for custom comparison and inclusion test, instead of compiler crashing. --- artiq/compiler/transforms/artiq_ir_generator.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/artiq/compiler/transforms/artiq_ir_generator.py b/artiq/compiler/transforms/artiq_ir_generator.py index f07094805..ef301c03f 100644 --- a/artiq/compiler/transforms/artiq_ir_generator.py +++ b/artiq/compiler/transforms/artiq_ir_generator.py @@ -1481,7 +1481,13 @@ class ARTIQIRGenerator(algorithm.Visitor): return result else: - assert False + loc = lhs.loc + loc.end = rhs.loc.end + diag = diagnostic.Diagnostic("error", + "Custom object comparison is not supported", + {}, + loc) + self.engine.process(diag) def polymorphic_compare_pair_inclusion(self, needle, haystack): if builtins.is_range(haystack.type): @@ -1525,7 +1531,13 @@ class ARTIQIRGenerator(algorithm.Visitor): result = phi else: - assert False + loc = needle.loc + loc.end = haystack.loc.end + diag = diagnostic.Diagnostic("error", + "Custom object inclusion test is not supported", + {}, + loc) + self.engine.process(diag) return result