assemblyscript
assemblyscript copied to clipboard
Infer calls based on their return types (maybe)
Edit: While working on #1129 I stumbled upon the following pattern that cannot be inferred yet because we don't yet attempt to recognize return types:
function foo(a: Set<i32> = new Set()) { ... }
function makeSet<T>(): Set<T> { ... }
foo(makeSet()); // expected 1 type argument, but got 0
Pinning here so we don't forget.
Turns out that the first sample
function foo(a: Set<i32> = new Set()) // expected 1 type argument, but got 0
(in the original post) came from a diagnostic I fixed now that should be suppressed but otherwise works, while the second is not implemented yet (requires inferring based on return type).
Up