61 lines
1.6 KiB
Plaintext
61 lines
1.6 KiB
Plaintext
|
=== tests/cases/compiler/contextualSignatureInstantiation1.ts ===
|
||
|
declare function map<S, T>(f: (x: S) => T): (a: S[]) => T[];
|
||
|
>map : <S, T>(f: (x: S) => T) => (a: S[]) => T[]
|
||
|
>S : S
|
||
|
>T : T
|
||
|
>f : (x: S) => T
|
||
|
>x : S
|
||
|
>S : S
|
||
|
>T : T
|
||
|
>a : S[]
|
||
|
>S : S
|
||
|
>T : T
|
||
|
|
||
|
var e = <K>(x: string, y?: K) => x.length;
|
||
|
>e : <K>(x: string, y?: K) => number
|
||
|
><K>(x: string, y?: K) => x.length : <K>(x: string, y?: K) => number
|
||
|
>K : K
|
||
|
>x : string
|
||
|
>y : K
|
||
|
>K : K
|
||
|
>x.length : number
|
||
|
>x : string
|
||
|
>length : number
|
||
|
|
||
|
var r99 = map(e); // should be {}[] for S since a generic lambda is not inferentially typed
|
||
|
>r99 : (a: {}[]) => number[]
|
||
|
>map(e) : (a: {}[]) => number[]
|
||
|
>map : <S, T>(f: (x: S) => T) => (a: S[]) => T[]
|
||
|
>e : <K>(x: string, y?: K) => number
|
||
|
|
||
|
declare function map2<S extends { length: number }, T>(f: (x: S) => T): (a: S[]) => T[];
|
||
|
>map2 : <S extends { length: number; }, T>(f: (x: S) => T) => (a: S[]) => T[]
|
||
|
>S : S
|
||
|
>length : number
|
||
|
>T : T
|
||
|
>f : (x: S) => T
|
||
|
>x : S
|
||
|
>S : S
|
||
|
>T : T
|
||
|
>a : S[]
|
||
|
>S : S
|
||
|
>T : T
|
||
|
|
||
|
var e2 = <K>(x: string, y?: K) => x.length;
|
||
|
>e2 : <K>(x: string, y?: K) => number
|
||
|
><K>(x: string, y?: K) => x.length : <K>(x: string, y?: K) => number
|
||
|
>K : K
|
||
|
>x : string
|
||
|
>y : K
|
||
|
>K : K
|
||
|
>x.length : number
|
||
|
>x : string
|
||
|
>length : number
|
||
|
|
||
|
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 : (a: { length: number; }[]) => number[]
|
||
|
>map2(e2) : (a: { length: number; }[]) => number[]
|
||
|
>map2 : <S extends { length: number; }, T>(f: (x: S) => T) => (a: S[]) => T[]
|
||
|
>e2 : <K>(x: string, y?: K) => number
|
||
|
|