mirror of https://github.com/m-labs/artiq.git
compiler: do not permit str(...). (#878)
This commit is contained in:
parent
bd47a0371f
commit
4d915ad15b
|
@ -682,6 +682,11 @@ class Inferencer(algorithm.Visitor):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
diagnose(valid_forms())
|
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"):
|
elif types.is_builtin(typ, "list") or types.is_builtin(typ, "array"):
|
||||||
if types.is_builtin(typ, "list"):
|
if types.is_builtin(typ, "list"):
|
||||||
valid_forms = lambda: [
|
valid_forms = lambda: [
|
||||||
|
|
|
@ -9,3 +9,6 @@ list(1)
|
||||||
|
|
||||||
# CHECK-L: ${LINE:+1}: error: the arguments of min() must be of a numeric type
|
# CHECK-L: ${LINE:+1}: error: the arguments of min() must be of a numeric type
|
||||||
min([1], [1])
|
min([1], [1])
|
||||||
|
|
||||||
|
# CHECK-L: ${LINE:+1}: error: strings currently cannot be constructed
|
||||||
|
str(1)
|
||||||
|
|
Loading…
Reference in New Issue