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

367 lines
27 KiB
Plaintext

=== tests/cases/conformance/expressions/contextualTyping/parenthesizedContexualTyping2.ts ===
// These tests ensure that in cases where it may *appear* that a value has a type,
// they actually are properly being contextually typed. The way we test this is
// that we invoke contextually typed arguments with type arguments.
// Since 'any' cannot be invoked with type arguments, we should get errors
// back if contextual typing is not taking effect.
type FuncType = (x: <T>(p: T) => T) => typeof x;
>FuncType : (x: <T>(p: T) => T) => <T>(p: T) => T, Symbol(FuncType, Decl(parenthesizedContexualTyping2.ts, 0, 0))
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 6, 17))
>T : T, Symbol(T, Decl(parenthesizedContexualTyping2.ts, 6, 21))
>p : T, Symbol(p, Decl(parenthesizedContexualTyping2.ts, 6, 24))
>T : T, Symbol(T, Decl(parenthesizedContexualTyping2.ts, 6, 21))
>T : T, Symbol(T, Decl(parenthesizedContexualTyping2.ts, 6, 21))
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 6, 17))
function fun<T>(f: FuncType, x: T): T;
>fun : { <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, g: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; }, Symbol(fun, Decl(parenthesizedContexualTyping2.ts, 6, 48), Decl(parenthesizedContexualTyping2.ts, 8, 38), Decl(parenthesizedContexualTyping2.ts, 9, 51))
>T : T, Symbol(T, Decl(parenthesizedContexualTyping2.ts, 8, 13))
>f : (x: <T>(p: T) => T) => <T>(p: T) => T, Symbol(f, Decl(parenthesizedContexualTyping2.ts, 8, 16))
>FuncType : (x: <T>(p: T) => T) => <T>(p: T) => T, Symbol(FuncType, Decl(parenthesizedContexualTyping2.ts, 0, 0))
>x : T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 8, 28))
>T : T, Symbol(T, Decl(parenthesizedContexualTyping2.ts, 8, 13))
>T : T, Symbol(T, Decl(parenthesizedContexualTyping2.ts, 8, 13))
function fun<T>(f: FuncType, g: FuncType, x: T): T;
>fun : { <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, g: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; }, Symbol(fun, Decl(parenthesizedContexualTyping2.ts, 6, 48), Decl(parenthesizedContexualTyping2.ts, 8, 38), Decl(parenthesizedContexualTyping2.ts, 9, 51))
>T : T, Symbol(T, Decl(parenthesizedContexualTyping2.ts, 9, 13))
>f : (x: <T>(p: T) => T) => <T>(p: T) => T, Symbol(f, Decl(parenthesizedContexualTyping2.ts, 9, 16))
>FuncType : (x: <T>(p: T) => T) => <T>(p: T) => T, Symbol(FuncType, Decl(parenthesizedContexualTyping2.ts, 0, 0))
>g : (x: <T>(p: T) => T) => <T>(p: T) => T, Symbol(g, Decl(parenthesizedContexualTyping2.ts, 9, 28))
>FuncType : (x: <T>(p: T) => T) => <T>(p: T) => T, Symbol(FuncType, Decl(parenthesizedContexualTyping2.ts, 0, 0))
>x : T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 9, 41))
>T : T, Symbol(T, Decl(parenthesizedContexualTyping2.ts, 9, 13))
>T : T, Symbol(T, Decl(parenthesizedContexualTyping2.ts, 9, 13))
function fun<T>(...rest: any[]): T {
>fun : { <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, g: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; }, Symbol(fun, Decl(parenthesizedContexualTyping2.ts, 6, 48), Decl(parenthesizedContexualTyping2.ts, 8, 38), Decl(parenthesizedContexualTyping2.ts, 9, 51))
>T : T, Symbol(T, Decl(parenthesizedContexualTyping2.ts, 10, 13))
>rest : any[], Symbol(rest, Decl(parenthesizedContexualTyping2.ts, 10, 16))
>T : T, Symbol(T, Decl(parenthesizedContexualTyping2.ts, 10, 13))
return undefined;
>undefined : undefined, Symbol(undefined)
}
var a = fun(x => { x<number>(undefined); return x; }, 10);
>a : number, Symbol(a, Decl(parenthesizedContexualTyping2.ts, 14, 3))
>fun(x => { x<number>(undefined); return x; }, 10) : number
>fun : { <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, g: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; }, Symbol(fun, Decl(parenthesizedContexualTyping2.ts, 6, 48), Decl(parenthesizedContexualTyping2.ts, 8, 38), Decl(parenthesizedContexualTyping2.ts, 9, 51))
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 14, 12))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 14, 12))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 14, 12))
>10 : number
var b = fun((x => { x<number>(undefined); return x; }), 10);
>b : number, Symbol(b, Decl(parenthesizedContexualTyping2.ts, 15, 3))
>fun((x => { x<number>(undefined); return x; }), 10) : number
>fun : { <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, g: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; }, Symbol(fun, Decl(parenthesizedContexualTyping2.ts, 6, 48), Decl(parenthesizedContexualTyping2.ts, 8, 38), Decl(parenthesizedContexualTyping2.ts, 9, 51))
>(x => { x<number>(undefined); return x; }) : (x: <T>(p: T) => T) => <T>(p: T) => T
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 15, 13))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 15, 13))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 15, 13))
>10 : number
var c = fun(((x => { x<number>(undefined); return x; })), 10);
>c : number, Symbol(c, Decl(parenthesizedContexualTyping2.ts, 16, 3))
>fun(((x => { x<number>(undefined); return x; })), 10) : number
>fun : { <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, g: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; }, Symbol(fun, Decl(parenthesizedContexualTyping2.ts, 6, 48), Decl(parenthesizedContexualTyping2.ts, 8, 38), Decl(parenthesizedContexualTyping2.ts, 9, 51))
>((x => { x<number>(undefined); return x; })) : (x: <T>(p: T) => T) => <T>(p: T) => T
>(x => { x<number>(undefined); return x; }) : (x: <T>(p: T) => T) => <T>(p: T) => T
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 16, 14))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 16, 14))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 16, 14))
>10 : number
var d = fun((((x => { x<number>(undefined); return x; }))), 10);
>d : number, Symbol(d, Decl(parenthesizedContexualTyping2.ts, 17, 3))
>fun((((x => { x<number>(undefined); return x; }))), 10) : number
>fun : { <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, g: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; }, Symbol(fun, Decl(parenthesizedContexualTyping2.ts, 6, 48), Decl(parenthesizedContexualTyping2.ts, 8, 38), Decl(parenthesizedContexualTyping2.ts, 9, 51))
>(((x => { x<number>(undefined); return x; }))) : (x: <T>(p: T) => T) => <T>(p: T) => T
>((x => { x<number>(undefined); return x; })) : (x: <T>(p: T) => T) => <T>(p: T) => T
>(x => { x<number>(undefined); return x; }) : (x: <T>(p: T) => T) => <T>(p: T) => T
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 17, 15))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 17, 15))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 17, 15))
>10 : number
var e = fun(x => { x<number>(undefined); return x; }, x => { x<number>(undefined); return x; }, 10);
>e : number, Symbol(e, Decl(parenthesizedContexualTyping2.ts, 19, 3))
>fun(x => { x<number>(undefined); return x; }, x => { x<number>(undefined); return x; }, 10) : number
>fun : { <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, g: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; }, Symbol(fun, Decl(parenthesizedContexualTyping2.ts, 6, 48), Decl(parenthesizedContexualTyping2.ts, 8, 38), Decl(parenthesizedContexualTyping2.ts, 9, 51))
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 19, 12))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 19, 12))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 19, 12))
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 19, 53))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 19, 53))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 19, 53))
>10 : number
var f = fun((x => { x<number>(undefined); return x; }),(x => { x<number>(undefined); return x; }), 10);
>f : number, Symbol(f, Decl(parenthesizedContexualTyping2.ts, 20, 3))
>fun((x => { x<number>(undefined); return x; }),(x => { x<number>(undefined); return x; }), 10) : number
>fun : { <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, g: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; }, Symbol(fun, Decl(parenthesizedContexualTyping2.ts, 6, 48), Decl(parenthesizedContexualTyping2.ts, 8, 38), Decl(parenthesizedContexualTyping2.ts, 9, 51))
>(x => { x<number>(undefined); return x; }) : (x: <T>(p: T) => T) => <T>(p: T) => T
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 20, 13))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 20, 13))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 20, 13))
>(x => { x<number>(undefined); return x; }) : (x: <T>(p: T) => T) => <T>(p: T) => T
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 20, 56))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 20, 56))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 20, 56))
>10 : number
var g = fun(((x => { x<number>(undefined); return x; })),((x => { x<number>(undefined); return x; })), 10);
>g : number, Symbol(g, Decl(parenthesizedContexualTyping2.ts, 21, 3))
>fun(((x => { x<number>(undefined); return x; })),((x => { x<number>(undefined); return x; })), 10) : number
>fun : { <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, g: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; }, Symbol(fun, Decl(parenthesizedContexualTyping2.ts, 6, 48), Decl(parenthesizedContexualTyping2.ts, 8, 38), Decl(parenthesizedContexualTyping2.ts, 9, 51))
>((x => { x<number>(undefined); return x; })) : (x: <T>(p: T) => T) => <T>(p: T) => T
>(x => { x<number>(undefined); return x; }) : (x: <T>(p: T) => T) => <T>(p: T) => T
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 21, 14))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 21, 14))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 21, 14))
>((x => { x<number>(undefined); return x; })) : (x: <T>(p: T) => T) => <T>(p: T) => T
>(x => { x<number>(undefined); return x; }) : (x: <T>(p: T) => T) => <T>(p: T) => T
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 21, 59))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 21, 59))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 21, 59))
>10 : number
var h = fun((((x => { x<number>(undefined); return x; }))),((x => { x<number>(undefined); return x; })), 10);
>h : number, Symbol(h, Decl(parenthesizedContexualTyping2.ts, 22, 3))
>fun((((x => { x<number>(undefined); return x; }))),((x => { x<number>(undefined); return x; })), 10) : number
>fun : { <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, g: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; }, Symbol(fun, Decl(parenthesizedContexualTyping2.ts, 6, 48), Decl(parenthesizedContexualTyping2.ts, 8, 38), Decl(parenthesizedContexualTyping2.ts, 9, 51))
>(((x => { x<number>(undefined); return x; }))) : (x: <T>(p: T) => T) => <T>(p: T) => T
>((x => { x<number>(undefined); return x; })) : (x: <T>(p: T) => T) => <T>(p: T) => T
>(x => { x<number>(undefined); return x; }) : (x: <T>(p: T) => T) => <T>(p: T) => T
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 22, 15))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 22, 15))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 22, 15))
>((x => { x<number>(undefined); return x; })) : (x: <T>(p: T) => T) => <T>(p: T) => T
>(x => { x<number>(undefined); return x; }) : (x: <T>(p: T) => T) => <T>(p: T) => T
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 22, 61))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 22, 61))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 22, 61))
>10 : number
// Ternaries in parens
var i = fun((Math.random() < 0.5 ? x => { x<number>(undefined); return x; } : x => undefined), 10);
>i : number, Symbol(i, Decl(parenthesizedContexualTyping2.ts, 25, 3))
>fun((Math.random() < 0.5 ? x => { x<number>(undefined); return x; } : x => undefined), 10) : number
>fun : { <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, g: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; }, Symbol(fun, Decl(parenthesizedContexualTyping2.ts, 6, 48), Decl(parenthesizedContexualTyping2.ts, 8, 38), Decl(parenthesizedContexualTyping2.ts, 9, 51))
>(Math.random() < 0.5 ? x => { x<number>(undefined); return x; } : x => undefined) : (x: <T>(p: T) => T) => any
>Math.random() < 0.5 ? x => { x<number>(undefined); return x; } : x => undefined : (x: <T>(p: T) => T) => any
>Math.random() < 0.5 : boolean
>Math.random() : number
>Math.random : () => number, Symbol(Math.random, Decl(lib.d.ts, 608, 38))
>Math : Math, Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11))
>random : () => number, Symbol(Math.random, Decl(lib.d.ts, 608, 38))
>0.5 : number
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 25, 34))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 25, 34))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 25, 34))
>x => undefined : (x: <T>(p: T) => T) => any
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 25, 77))
>undefined : undefined, Symbol(undefined)
>10 : number
var j = fun((Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) : (x => undefined)), 10);
>j : number, Symbol(j, Decl(parenthesizedContexualTyping2.ts, 26, 3))
>fun((Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) : (x => undefined)), 10) : number
>fun : { <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, g: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; }, Symbol(fun, Decl(parenthesizedContexualTyping2.ts, 6, 48), Decl(parenthesizedContexualTyping2.ts, 8, 38), Decl(parenthesizedContexualTyping2.ts, 9, 51))
>(Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) : (x => undefined)) : (x: <T>(p: T) => T) => any
>Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) : (x => undefined) : (x: <T>(p: T) => T) => any
>Math.random() < 0.5 : boolean
>Math.random() : number
>Math.random : () => number, Symbol(Math.random, Decl(lib.d.ts, 608, 38))
>Math : Math, Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11))
>random : () => number, Symbol(Math.random, Decl(lib.d.ts, 608, 38))
>0.5 : number
>(x => { x<number>(undefined); return x; }) : (x: <T>(p: T) => T) => <T>(p: T) => T
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 26, 36))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 26, 36))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 26, 36))
>(x => undefined) : (x: <T>(p: T) => T) => any
>x => undefined : (x: <T>(p: T) => T) => any
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 26, 81))
>undefined : undefined, Symbol(undefined)
>10 : number
var k = fun((Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) : (x => undefined)), x => { x<number>(undefined); return x; }, 10);
>k : number, Symbol(k, Decl(parenthesizedContexualTyping2.ts, 27, 3))
>fun((Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) : (x => undefined)), x => { x<number>(undefined); return x; }, 10) : number
>fun : { <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, g: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; }, Symbol(fun, Decl(parenthesizedContexualTyping2.ts, 6, 48), Decl(parenthesizedContexualTyping2.ts, 8, 38), Decl(parenthesizedContexualTyping2.ts, 9, 51))
>(Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) : (x => undefined)) : (x: <T>(p: T) => T) => any
>Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) : (x => undefined) : (x: <T>(p: T) => T) => any
>Math.random() < 0.5 : boolean
>Math.random() : number
>Math.random : () => number, Symbol(Math.random, Decl(lib.d.ts, 608, 38))
>Math : Math, Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11))
>random : () => number, Symbol(Math.random, Decl(lib.d.ts, 608, 38))
>0.5 : number
>(x => { x<number>(undefined); return x; }) : (x: <T>(p: T) => T) => <T>(p: T) => T
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 27, 36))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 27, 36))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 27, 36))
>(x => undefined) : (x: <T>(p: T) => T) => any
>x => undefined : (x: <T>(p: T) => T) => any
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 27, 81))
>undefined : undefined, Symbol(undefined)
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 27, 98))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 27, 98))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 27, 98))
>10 : number
var l = fun(((Math.random() < 0.5 ? ((x => { x<number>(undefined); return x; })) : ((x => undefined)))),((x => { x<number>(undefined); return x; })), 10);
>l : number, Symbol(l, Decl(parenthesizedContexualTyping2.ts, 28, 3))
>fun(((Math.random() < 0.5 ? ((x => { x<number>(undefined); return x; })) : ((x => undefined)))),((x => { x<number>(undefined); return x; })), 10) : number
>fun : { <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; <T>(f: (x: <T>(p: T) => T) => <T>(p: T) => T, g: (x: <T>(p: T) => T) => <T>(p: T) => T, x: T): T; }, Symbol(fun, Decl(parenthesizedContexualTyping2.ts, 6, 48), Decl(parenthesizedContexualTyping2.ts, 8, 38), Decl(parenthesizedContexualTyping2.ts, 9, 51))
>((Math.random() < 0.5 ? ((x => { x<number>(undefined); return x; })) : ((x => undefined)))) : (x: <T>(p: T) => T) => any
>(Math.random() < 0.5 ? ((x => { x<number>(undefined); return x; })) : ((x => undefined))) : (x: <T>(p: T) => T) => any
>Math.random() < 0.5 ? ((x => { x<number>(undefined); return x; })) : ((x => undefined)) : (x: <T>(p: T) => T) => any
>Math.random() < 0.5 : boolean
>Math.random() : number
>Math.random : () => number, Symbol(Math.random, Decl(lib.d.ts, 608, 38))
>Math : Math, Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11))
>random : () => number, Symbol(Math.random, Decl(lib.d.ts, 608, 38))
>0.5 : number
>((x => { x<number>(undefined); return x; })) : (x: <T>(p: T) => T) => <T>(p: T) => T
>(x => { x<number>(undefined); return x; }) : (x: <T>(p: T) => T) => <T>(p: T) => T
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 28, 38))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 28, 38))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 28, 38))
>((x => undefined)) : (x: <T>(p: T) => T) => any
>(x => undefined) : (x: <T>(p: T) => T) => any
>x => undefined : (x: <T>(p: T) => T) => any
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 28, 85))
>undefined : undefined, Symbol(undefined)
>((x => { x<number>(undefined); return x; })) : (x: <T>(p: T) => T) => <T>(p: T) => T
>(x => { x<number>(undefined); return x; }) : (x: <T>(p: T) => T) => <T>(p: T) => T
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 28, 106))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 28, 106))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 28, 106))
>10 : number
var lambda1: FuncType = x => { x<number>(undefined); return x; };
>lambda1 : (x: <T>(p: T) => T) => <T>(p: T) => T, Symbol(lambda1, Decl(parenthesizedContexualTyping2.ts, 30, 3))
>FuncType : (x: <T>(p: T) => T) => <T>(p: T) => T, Symbol(FuncType, Decl(parenthesizedContexualTyping2.ts, 0, 0))
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 30, 23))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 30, 23))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 30, 23))
var lambda2: FuncType = (x => { x<number>(undefined); return x; });
>lambda2 : (x: <T>(p: T) => T) => <T>(p: T) => T, Symbol(lambda2, Decl(parenthesizedContexualTyping2.ts, 31, 3))
>FuncType : (x: <T>(p: T) => T) => <T>(p: T) => T, Symbol(FuncType, Decl(parenthesizedContexualTyping2.ts, 0, 0))
>(x => { x<number>(undefined); return x; }) : (x: <T>(p: T) => T) => <T>(p: T) => T
>x => { x<number>(undefined); return x; } : (x: <T>(p: T) => T) => <T>(p: T) => T
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 31, 25))
>x<number>(undefined) : number
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 31, 25))
>undefined : undefined, Symbol(undefined)
>x : <T>(p: T) => T, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 31, 25))
type ObjType = { x: (p: number) => string; y: (p: string) => number };
>ObjType : { x: (p: number) => string; y: (p: string) => number; }, Symbol(ObjType, Decl(parenthesizedContexualTyping2.ts, 31, 67))
>x : (p: number) => string, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 33, 16))
>p : number, Symbol(p, Decl(parenthesizedContexualTyping2.ts, 33, 21))
>y : (p: string) => number, Symbol(y, Decl(parenthesizedContexualTyping2.ts, 33, 42))
>p : string, Symbol(p, Decl(parenthesizedContexualTyping2.ts, 33, 47))
var obj1: ObjType = { x: x => (x, undefined), y: y => (y, undefined) };
>obj1 : { x: (p: number) => string; y: (p: string) => number; }, Symbol(obj1, Decl(parenthesizedContexualTyping2.ts, 34, 3))
>ObjType : { x: (p: number) => string; y: (p: string) => number; }, Symbol(ObjType, Decl(parenthesizedContexualTyping2.ts, 31, 67))
>{ x: x => (x, undefined), y: y => (y, undefined) } : { x: (x: number) => any; y: (y: string) => any; }
>x : (x: number) => any, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 34, 21))
>x => (x, undefined) : (x: number) => any
>x : number, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 34, 24))
>(x, undefined) : undefined
>x, undefined : undefined
>x : number, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 34, 24))
>undefined : undefined, Symbol(undefined)
>y : (y: string) => any, Symbol(y, Decl(parenthesizedContexualTyping2.ts, 34, 45))
>y => (y, undefined) : (y: string) => any
>y : string, Symbol(y, Decl(parenthesizedContexualTyping2.ts, 34, 48))
>(y, undefined) : undefined
>y, undefined : undefined
>y : string, Symbol(y, Decl(parenthesizedContexualTyping2.ts, 34, 48))
>undefined : undefined, Symbol(undefined)
var obj2: ObjType = ({ x: x => (x, undefined), y: y => (y, undefined) });
>obj2 : { x: (p: number) => string; y: (p: string) => number; }, Symbol(obj2, Decl(parenthesizedContexualTyping2.ts, 35, 3))
>ObjType : { x: (p: number) => string; y: (p: string) => number; }, Symbol(ObjType, Decl(parenthesizedContexualTyping2.ts, 31, 67))
>({ x: x => (x, undefined), y: y => (y, undefined) }) : { x: (x: number) => any; y: (y: string) => any; }
>{ x: x => (x, undefined), y: y => (y, undefined) } : { x: (x: number) => any; y: (y: string) => any; }
>x : (x: number) => any, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 35, 22))
>x => (x, undefined) : (x: number) => any
>x : number, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 35, 25))
>(x, undefined) : undefined
>x, undefined : undefined
>x : number, Symbol(x, Decl(parenthesizedContexualTyping2.ts, 35, 25))
>undefined : undefined, Symbol(undefined)
>y : (y: string) => any, Symbol(y, Decl(parenthesizedContexualTyping2.ts, 35, 46))
>y => (y, undefined) : (y: string) => any
>y : string, Symbol(y, Decl(parenthesizedContexualTyping2.ts, 35, 49))
>(y, undefined) : undefined
>y, undefined : undefined
>y : string, Symbol(y, Decl(parenthesizedContexualTyping2.ts, 35, 49))
>undefined : undefined, Symbol(undefined)