56 lines
3.4 KiB
Text
56 lines
3.4 KiB
Text
=== tests/cases/compiler/contextualSignatureInstantiation1.ts ===
|
|
declare function map<S, T>(f: (x: S) => T): (a: S[]) => T[];
|
|
>map : Symbol(map, Decl(contextualSignatureInstantiation1.ts, 0, 0))
|
|
>S : Symbol(S, Decl(contextualSignatureInstantiation1.ts, 0, 21))
|
|
>T : Symbol(T, Decl(contextualSignatureInstantiation1.ts, 0, 23))
|
|
>f : Symbol(f, Decl(contextualSignatureInstantiation1.ts, 0, 27))
|
|
>x : Symbol(x, Decl(contextualSignatureInstantiation1.ts, 0, 31))
|
|
>S : Symbol(S, Decl(contextualSignatureInstantiation1.ts, 0, 21))
|
|
>T : Symbol(T, Decl(contextualSignatureInstantiation1.ts, 0, 23))
|
|
>a : Symbol(a, Decl(contextualSignatureInstantiation1.ts, 0, 45))
|
|
>S : Symbol(S, Decl(contextualSignatureInstantiation1.ts, 0, 21))
|
|
>T : Symbol(T, Decl(contextualSignatureInstantiation1.ts, 0, 23))
|
|
|
|
var e = <K>(x: string, y?: K) => x.length;
|
|
>e : Symbol(e, Decl(contextualSignatureInstantiation1.ts, 1, 3))
|
|
>K : Symbol(K, Decl(contextualSignatureInstantiation1.ts, 1, 9))
|
|
>x : Symbol(x, Decl(contextualSignatureInstantiation1.ts, 1, 12))
|
|
>y : Symbol(y, Decl(contextualSignatureInstantiation1.ts, 1, 22))
|
|
>K : Symbol(K, Decl(contextualSignatureInstantiation1.ts, 1, 9))
|
|
>x.length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
|
|
>x : Symbol(x, Decl(contextualSignatureInstantiation1.ts, 1, 12))
|
|
>length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
|
|
|
|
var r99 = map(e); // should be {}[] for S since a generic lambda is not inferentially typed
|
|
>r99 : Symbol(r99, Decl(contextualSignatureInstantiation1.ts, 2, 3))
|
|
>map : Symbol(map, Decl(contextualSignatureInstantiation1.ts, 0, 0))
|
|
>e : Symbol(e, Decl(contextualSignatureInstantiation1.ts, 1, 3))
|
|
|
|
declare function map2<S extends { length: number }, T>(f: (x: S) => T): (a: S[]) => T[];
|
|
>map2 : Symbol(map2, Decl(contextualSignatureInstantiation1.ts, 2, 17))
|
|
>S : Symbol(S, Decl(contextualSignatureInstantiation1.ts, 4, 22))
|
|
>length : Symbol(length, Decl(contextualSignatureInstantiation1.ts, 4, 33))
|
|
>T : Symbol(T, Decl(contextualSignatureInstantiation1.ts, 4, 51))
|
|
>f : Symbol(f, Decl(contextualSignatureInstantiation1.ts, 4, 55))
|
|
>x : Symbol(x, Decl(contextualSignatureInstantiation1.ts, 4, 59))
|
|
>S : Symbol(S, Decl(contextualSignatureInstantiation1.ts, 4, 22))
|
|
>T : Symbol(T, Decl(contextualSignatureInstantiation1.ts, 4, 51))
|
|
>a : Symbol(a, Decl(contextualSignatureInstantiation1.ts, 4, 73))
|
|
>S : Symbol(S, Decl(contextualSignatureInstantiation1.ts, 4, 22))
|
|
>T : Symbol(T, Decl(contextualSignatureInstantiation1.ts, 4, 51))
|
|
|
|
var e2 = <K>(x: string, y?: K) => x.length;
|
|
>e2 : Symbol(e2, Decl(contextualSignatureInstantiation1.ts, 5, 3))
|
|
>K : Symbol(K, Decl(contextualSignatureInstantiation1.ts, 5, 10))
|
|
>x : Symbol(x, Decl(contextualSignatureInstantiation1.ts, 5, 13))
|
|
>y : Symbol(y, Decl(contextualSignatureInstantiation1.ts, 5, 23))
|
|
>K : Symbol(K, Decl(contextualSignatureInstantiation1.ts, 5, 10))
|
|
>x.length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
|
|
>x : Symbol(x, Decl(contextualSignatureInstantiation1.ts, 5, 13))
|
|
>length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
|
|
|
|
var r100 = map2(e2); // type arg inference should fail for S since a generic lambda is not inferentially typed. Falls back to { length: number }
|
|
>r100 : Symbol(r100, Decl(contextualSignatureInstantiation1.ts, 6, 3))
|
|
>map2 : Symbol(map2, Decl(contextualSignatureInstantiation1.ts, 2, 17))
|
|
>e2 : Symbol(e2, Decl(contextualSignatureInstantiation1.ts, 5, 3))
|
|
|