forked from M-Labs/artiq
1
0
Fork 0

compiler: do not permit str(...). (#878)

This commit is contained in:
whitequark 2017-12-27 01:52:27 +00:00
parent bd47a0371f
commit 4d915ad15b
2 changed files with 8 additions and 0 deletions

View File

@ -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: [

View File

@ -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)