From 3ec9b677b255fdcc788b2bcb2024f4359f17cf0a Mon Sep 17 00:00:00 2001 From: whitequark Date: Thu, 10 Dec 2015 22:25:15 +0800 Subject: [PATCH] Revert "transforms.artiq_ir_generator: treat builtins in 'with' syntactically." This reverts commit ccc993071b36dab565f849b1883d6fece08723ae. --- artiq/compiler/transforms/artiq_ir_generator.py | 9 ++------- artiq/compiler/transforms/inferencer.py | 6 +----- lit-test/test/inferencer/error_illegal_builtin.py | 5 ----- 3 files changed, 3 insertions(+), 17 deletions(-) delete mode 100644 lit-test/test/inferencer/error_illegal_builtin.py diff --git a/artiq/compiler/transforms/artiq_ir_generator.py b/artiq/compiler/transforms/artiq_ir_generator.py index f7510516b..e29949299 100644 --- a/artiq/compiler/transforms/artiq_ir_generator.py +++ b/artiq/compiler/transforms/artiq_ir_generator.py @@ -695,11 +695,9 @@ class ARTIQIRGenerator(algorithm.Visitor): context_expr_node = node.items[0].context_expr optional_vars_node = node.items[0].optional_vars - if isinstance(context_expr_node, asttyped.NameT) and \ - context_expr_node.id == "sequential": + if types.is_builtin(context_expr_node.type, "sequential"): self.visit(node.body) - elif isinstance(context_expr_node, asttyped.NameT) and \ - context_expr_node.id == "parallel": + elif types.is_builtin(context_expr_node.type, "parallel"): parallel = self.append(ir.Parallel([])) heads, tails = [], [] @@ -717,9 +715,6 @@ class ARTIQIRGenerator(algorithm.Visitor): if not tail.is_terminated(): tail.append(ir.Branch(self.current_block)) - else: - assert False - # Expression visitors # These visitors return a node in addition to mutating # the IR. diff --git a/artiq/compiler/transforms/inferencer.py b/artiq/compiler/transforms/inferencer.py index 38115fdf2..8ebe4f5b7 100644 --- a/artiq/compiler/transforms/inferencer.py +++ b/artiq/compiler/transforms/inferencer.py @@ -762,11 +762,7 @@ class Inferencer(algorithm.Visitor): self._unify(node.type, typ.find().instance, node.loc, None) else: - diag = diagnostic.Diagnostic("error", - "builtin function '{name}' cannot be used in this context", - {"name": typ.name}, - node.loc) - self.engine.process(diag) + assert False def visit_CallT(self, node): self.generic_visit(node) diff --git a/lit-test/test/inferencer/error_illegal_builtin.py b/lit-test/test/inferencer/error_illegal_builtin.py deleted file mode 100644 index ea8b66a3f..000000000 --- a/lit-test/test/inferencer/error_illegal_builtin.py +++ /dev/null @@ -1,5 +0,0 @@ -# RUN: %python -m artiq.compiler.testbench.inferencer +diag %s >%t -# RUN: OutputCheck %s --file-to-check=%t - -# CHECK-L: ${LINE:+1}: error: builtin function 'sequential' cannot be used in this context -sequential()