diff --git a/artiq/compiler/transforms/inferencer.py b/artiq/compiler/transforms/inferencer.py index c4fb07b94..5c54f235c 100644 --- a/artiq/compiler/transforms/inferencer.py +++ b/artiq/compiler/transforms/inferencer.py @@ -682,6 +682,11 @@ class Inferencer(algorithm.Visitor): pass else: diagnose(valid_forms()) + elif types.is_builtin(typ, "str"): + diag = diagnostic.Diagnostic("error", + "strings currently cannot be constructed", {}, + node.loc) + self.engine.process(diag) elif types.is_builtin(typ, "list") or types.is_builtin(typ, "array"): if types.is_builtin(typ, "list"): valid_forms = lambda: [ diff --git a/artiq/test/lit/inferencer/error_builtin_calls.py b/artiq/test/lit/inferencer/error_builtin_calls.py index f3d8b7df8..bb1b8ca04 100644 --- a/artiq/test/lit/inferencer/error_builtin_calls.py +++ b/artiq/test/lit/inferencer/error_builtin_calls.py @@ -9,3 +9,6 @@ list(1) # CHECK-L: ${LINE:+1}: error: the arguments of min() must be of a numeric type min([1], [1]) + +# CHECK-L: ${LINE:+1}: error: strings currently cannot be constructed +str(1)