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

pull/882/merge
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
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: [

View File

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