assemblyscript icon indicating copy to clipboard operation
assemblyscript copied to clipboard

Infer calls based on their return types (maybe)

Open dcodeIO opened this issue 5 years ago • 2 comments

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.

dcodeIO avatar Mar 01 '20 21:03 dcodeIO

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

dcodeIO avatar Mar 02 '20 02:03 dcodeIO

Up

MaxGraey avatar Aug 22 '22 09:08 MaxGraey