TypeScript/tests/baselines/reference/taggedTemplateContextualTyping2.types
2015-04-13 14:29:37 -07:00

95 lines
8.4 KiB
Plaintext

=== tests/cases/conformance/expressions/contextualTyping/taggedTemplateContextualTyping2.ts ===
type FuncType1 = (x: <T>(p: T) => T) => typeof x;
>FuncType1 : (x: <T>(p: T) => T) => <T>(p: T) => T, Symbol(FuncType1, Decl(taggedTemplateContextualTyping2.ts, 0, 0))
>x : <T>(p: T) => T, Symbol(x, Decl(taggedTemplateContextualTyping2.ts, 1, 18))
>T : T, Symbol(T, Decl(taggedTemplateContextualTyping2.ts, 1, 22))
>p : T, Symbol(p, Decl(taggedTemplateContextualTyping2.ts, 1, 25))
>T : T, Symbol(T, Decl(taggedTemplateContextualTyping2.ts, 1, 22))
>T : T, Symbol(T, Decl(taggedTemplateContextualTyping2.ts, 1, 22))
>x : <T>(p: T) => T, Symbol(x, Decl(taggedTemplateContextualTyping2.ts, 1, 18))
type FuncType2 = (x: <S, T>(p: T) => T) => typeof x;
>FuncType2 : (x: <S, T>(p: T) => T) => <S, T>(p: T) => T, Symbol(FuncType2, Decl(taggedTemplateContextualTyping2.ts, 1, 49))
>x : <S, T>(p: T) => T, Symbol(x, Decl(taggedTemplateContextualTyping2.ts, 2, 18))
>S : S, Symbol(S, Decl(taggedTemplateContextualTyping2.ts, 2, 22))
>T : T, Symbol(T, Decl(taggedTemplateContextualTyping2.ts, 2, 24))
>p : T, Symbol(p, Decl(taggedTemplateContextualTyping2.ts, 2, 28))
>T : T, Symbol(T, Decl(taggedTemplateContextualTyping2.ts, 2, 24))
>T : T, Symbol(T, Decl(taggedTemplateContextualTyping2.ts, 2, 24))
>x : <S, T>(p: T) => T, Symbol(x, Decl(taggedTemplateContextualTyping2.ts, 2, 18))
function tempTag2(templateStrs: TemplateStringsArray, f: FuncType1, x: number): number;
>tempTag2 : { (templateStrs: TemplateStringsArray, f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: number): number; (templateStrs: TemplateStringsArray, f: (x: <S, T>(p: T) => T) => <S, T>(p: T) => T, h: (x: <S, T>(p: T) => T) => <S, T>(p: T) => T, x: string): string; }, Symbol(tempTag2, Decl(taggedTemplateContextualTyping2.ts, 2, 52), Decl(taggedTemplateContextualTyping2.ts, 4, 87), Decl(taggedTemplateContextualTyping2.ts, 5, 101))
>templateStrs : TemplateStringsArray, Symbol(templateStrs, Decl(taggedTemplateContextualTyping2.ts, 4, 18))
>TemplateStringsArray : TemplateStringsArray, Symbol(TemplateStringsArray, Decl(lib.d.ts, 518, 38))
>f : (x: <T>(p: T) => T) => <T>(p: T) => T, Symbol(f, Decl(taggedTemplateContextualTyping2.ts, 4, 53))
>FuncType1 : (x: <T>(p: T) => T) => <T>(p: T) => T, Symbol(FuncType1, Decl(taggedTemplateContextualTyping2.ts, 0, 0))
>x : number, Symbol(x, Decl(taggedTemplateContextualTyping2.ts, 4, 67))
function tempTag2(templateStrs: TemplateStringsArray, f: FuncType2, h: FuncType2, x: string): string;
>tempTag2 : { (templateStrs: TemplateStringsArray, f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: number): number; (templateStrs: TemplateStringsArray, f: (x: <S, T>(p: T) => T) => <S, T>(p: T) => T, h: (x: <S, T>(p: T) => T) => <S, T>(p: T) => T, x: string): string; }, Symbol(tempTag2, Decl(taggedTemplateContextualTyping2.ts, 2, 52), Decl(taggedTemplateContextualTyping2.ts, 4, 87), Decl(taggedTemplateContextualTyping2.ts, 5, 101))
>templateStrs : TemplateStringsArray, Symbol(templateStrs, Decl(taggedTemplateContextualTyping2.ts, 5, 18))
>TemplateStringsArray : TemplateStringsArray, Symbol(TemplateStringsArray, Decl(lib.d.ts, 518, 38))
>f : (x: <S, T>(p: T) => T) => <S, T>(p: T) => T, Symbol(f, Decl(taggedTemplateContextualTyping2.ts, 5, 53))
>FuncType2 : (x: <S, T>(p: T) => T) => <S, T>(p: T) => T, Symbol(FuncType2, Decl(taggedTemplateContextualTyping2.ts, 1, 49))
>h : (x: <S, T>(p: T) => T) => <S, T>(p: T) => T, Symbol(h, Decl(taggedTemplateContextualTyping2.ts, 5, 67))
>FuncType2 : (x: <S, T>(p: T) => T) => <S, T>(p: T) => T, Symbol(FuncType2, Decl(taggedTemplateContextualTyping2.ts, 1, 49))
>x : string, Symbol(x, Decl(taggedTemplateContextualTyping2.ts, 5, 81))
function tempTag2(...rest: any[]): any {
>tempTag2 : { (templateStrs: TemplateStringsArray, f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: number): number; (templateStrs: TemplateStringsArray, f: (x: <S, T>(p: T) => T) => <S, T>(p: T) => T, h: (x: <S, T>(p: T) => T) => <S, T>(p: T) => T, x: string): string; }, Symbol(tempTag2, Decl(taggedTemplateContextualTyping2.ts, 2, 52), Decl(taggedTemplateContextualTyping2.ts, 4, 87), Decl(taggedTemplateContextualTyping2.ts, 5, 101))
>rest : any[], Symbol(rest, Decl(taggedTemplateContextualTyping2.ts, 6, 18))
return undefined;
>undefined : undefined, Symbol(undefined)
}
// If contextual typing takes place, these functions should work.
// Otherwise, the arrow functions' parameters will be typed as 'any',
// and it is an error to invoke an any-typed value with type arguments,
// so this test will error.
tempTag2 `${ x => { x<number>(undefined); return x; } }${ 0 }`;
>tempTag2 `${ x => { x<number>(undefined); return x; } }${ 0 }` : number
>tempTag2 : { (templateStrs: TemplateStringsArray, f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: number): number; (templateStrs: TemplateStringsArray, f: (x: <S, T>(p: T) => T) => <S, T>(p: T) => T, h: (x: <S, T>(p: T) => T) => <S, T>(p: T) => T, x: string): string; }, Symbol(tempTag2, Decl(taggedTemplateContextualTyping2.ts, 2, 52), Decl(taggedTemplateContextualTyping2.ts, 4, 87), Decl(taggedTemplateContextualTyping2.ts, 5, 101))
>`${ x => { x<number>(undefined); return x; } }${ 0 }` : string
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(taggedTemplateContextualTyping2.ts, 14, 12))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(taggedTemplateContextualTyping2.ts, 14, 12))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(taggedTemplateContextualTyping2.ts, 14, 12))
>0 : number
tempTag2 `${ x => { x<number, string>(undefined); return x; } }${ y => { y<string, number>(null); return y; } }${ "hello" }`;
>tempTag2 `${ x => { x<number, string>(undefined); return x; } }${ y => { y<string, number>(null); return y; } }${ "hello" }` : string
>tempTag2 : { (templateStrs: TemplateStringsArray, f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: number): number; (templateStrs: TemplateStringsArray, f: (x: <S, T>(p: T) => T) => <S, T>(p: T) => T, h: (x: <S, T>(p: T) => T) => <S, T>(p: T) => T, x: string): string; }, Symbol(tempTag2, Decl(taggedTemplateContextualTyping2.ts, 2, 52), Decl(taggedTemplateContextualTyping2.ts, 4, 87), Decl(taggedTemplateContextualTyping2.ts, 5, 101))
>`${ x => { x<number, string>(undefined); return x; } }${ y => { y<string, number>(null); return y; } }${ "hello" }` : string
>x => { x<number, string>(undefined); return x; } : (x: <S, T>(p: T) => T) => <S, T>(p: T) => T
>x : <S, T>(p: T) => T, Symbol(x, Decl(taggedTemplateContextualTyping2.ts, 15, 12))
>x<number, string>(undefined) : string
>x : <S, T>(p: T) => T, Symbol(x, Decl(taggedTemplateContextualTyping2.ts, 15, 12))
>undefined : undefined, Symbol(undefined)
>x : <S, T>(p: T) => T, Symbol(x, Decl(taggedTemplateContextualTyping2.ts, 15, 12))
>y => { y<string, number>(null); return y; } : (y: <S, T>(p: T) => T) => <S, T>(p: T) => T
>y : <S, T>(p: T) => T, Symbol(y, Decl(taggedTemplateContextualTyping2.ts, 15, 65))
>y<string, number>(null) : number
>y : <S, T>(p: T) => T, Symbol(y, Decl(taggedTemplateContextualTyping2.ts, 15, 65))
>null : null
>y : <S, T>(p: T) => T, Symbol(y, Decl(taggedTemplateContextualTyping2.ts, 15, 65))
>"hello" : string
tempTag2 `${ x => { x<number, string>(undefined); return x; } }${ undefined }${ "hello" }`;
>tempTag2 `${ x => { x<number, string>(undefined); return x; } }${ undefined }${ "hello" }` : string
>tempTag2 : { (templateStrs: TemplateStringsArray, f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: number): number; (templateStrs: TemplateStringsArray, f: (x: <S, T>(p: T) => T) => <S, T>(p: T) => T, h: (x: <S, T>(p: T) => T) => <S, T>(p: T) => T, x: string): string; }, Symbol(tempTag2, Decl(taggedTemplateContextualTyping2.ts, 2, 52), Decl(taggedTemplateContextualTyping2.ts, 4, 87), Decl(taggedTemplateContextualTyping2.ts, 5, 101))
>`${ x => { x<number, string>(undefined); return x; } }${ undefined }${ "hello" }` : string
>x => { x<number, string>(undefined); return x; } : (x: <S, T>(p: T) => T) => <S, T>(p: T) => T
>x : <S, T>(p: T) => T, Symbol(x, Decl(taggedTemplateContextualTyping2.ts, 16, 12))
>x<number, string>(undefined) : string
>x : <S, T>(p: T) => T, Symbol(x, Decl(taggedTemplateContextualTyping2.ts, 16, 12))
>undefined : undefined, Symbol(undefined)
>x : <S, T>(p: T) => T, Symbol(x, Decl(taggedTemplateContextualTyping2.ts, 16, 12))
>undefined : undefined, Symbol(undefined)
>"hello" : string