js-slang
js-slang copied to clipboard
Source Typed: Support multiple function signatures of builtins
Right now builtins such as display
cannot be typechecked as it has multiple signatures
-
display(v: T): T
-
display(v: T, s: string): T
Should be a small fix though.
Source Typed gives: display(1, 2); Line 1: TypeError: display expects the second argument to be a string
The typechecker passes: display(); // runtime error and display(1, "asdf", 3); // no error: 3 is ignored
Is this "good enough"? should we close this issue?
I think we should add a runtime error if display and error have more than two arguments. There is already a runtime error for 0 arguments.