diff --git a/artiq/py2llvm/typing.py b/artiq/py2llvm/typing.py index a52041275..5e2c498fc 100644 --- a/artiq/py2llvm/typing.py +++ b/artiq/py2llvm/typing.py @@ -312,7 +312,6 @@ class ASTTypedRewriter(algorithm.Transformer): visit_Import = visit_unsupported visit_ImportFrom = visit_unsupported visit_Try = visit_unsupported - visit_With = visit_unsupported class Inferencer(algorithm.Visitor): @@ -725,6 +724,15 @@ class Inferencer(algorithm.Visitor): node.keyword_loc) self.engine.process(diag) + def visit_withitem(self, node): + self.generic_visit(node) + if True: # none are supported yet + diag = diagnostic.Diagnostic("error", + "value of type {type} cannot act as a context manager", + {"type": types.TypePrinter().name(node.context_expr.type)}, + node.context_expr.loc) + self.engine.process(diag) + def visit_FunctionDefT(self, node): old_function, self.function = self.function, node old_in_loop, self.in_loop = self.in_loop, False