733 lines
26 KiB
Text
733 lines
26 KiB
Text
|
=== tests/cases/compiler/contextualTyping.ts ===
|
||
|
// DEFAULT INTERFACES
|
||
|
interface IFoo {
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
n: number;
|
||
|
>n : Symbol(IFoo.n, Decl(contextualTyping.ts, 1, 16))
|
||
|
|
||
|
s: string;
|
||
|
>s : Symbol(IFoo.s, Decl(contextualTyping.ts, 2, 14))
|
||
|
|
||
|
f(i: number, s: string): string;
|
||
|
>f : Symbol(IFoo.f, Decl(contextualTyping.ts, 3, 14))
|
||
|
>i : Symbol(i, Decl(contextualTyping.ts, 4, 6))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 4, 16))
|
||
|
|
||
|
a: number[];
|
||
|
>a : Symbol(IFoo.a, Decl(contextualTyping.ts, 4, 36))
|
||
|
}
|
||
|
|
||
|
interface IBar {
|
||
|
>IBar : Symbol(IBar, Decl(contextualTyping.ts, 6, 1))
|
||
|
|
||
|
foo: IFoo;
|
||
|
>foo : Symbol(IBar.foo, Decl(contextualTyping.ts, 8, 16))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
}
|
||
|
|
||
|
// CONTEXT: Class property declaration
|
||
|
class C1T5 {
|
||
|
>C1T5 : Symbol(C1T5, Decl(contextualTyping.ts, 10, 1))
|
||
|
|
||
|
foo: (i: number, s: string) => number = function(i) {
|
||
|
>foo : Symbol(C1T5.foo, Decl(contextualTyping.ts, 13, 12))
|
||
|
>i : Symbol(i, Decl(contextualTyping.ts, 14, 10))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 14, 20))
|
||
|
>i : Symbol(i, Decl(contextualTyping.ts, 14, 53))
|
||
|
|
||
|
return i;
|
||
|
>i : Symbol(i, Decl(contextualTyping.ts, 14, 53))
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// CONTEXT: Module property declaration
|
||
|
module C2T5 {
|
||
|
>C2T5 : Symbol(C2T5, Decl(contextualTyping.ts, 17, 1))
|
||
|
|
||
|
export var foo: (i: number, s: string) => number = function(i) {
|
||
|
>foo : Symbol(foo, Decl(contextualTyping.ts, 21, 14))
|
||
|
>i : Symbol(i, Decl(contextualTyping.ts, 21, 21))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 21, 31))
|
||
|
>i : Symbol(i, Decl(contextualTyping.ts, 21, 64))
|
||
|
|
||
|
return i;
|
||
|
>i : Symbol(i, Decl(contextualTyping.ts, 21, 64))
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// CONTEXT: Variable declaration
|
||
|
var c3t1: (s: string) => string = (function(s) { return s });
|
||
|
>c3t1 : Symbol(c3t1, Decl(contextualTyping.ts, 27, 3))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 27, 11))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 27, 44))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 27, 44))
|
||
|
|
||
|
var c3t2 = <IFoo>({
|
||
|
>c3t2 : Symbol(c3t2, Decl(contextualTyping.ts, 28, 3))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
n: 1
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 28, 19))
|
||
|
|
||
|
})
|
||
|
var c3t3: number[] = [];
|
||
|
>c3t3 : Symbol(c3t3, Decl(contextualTyping.ts, 31, 3))
|
||
|
|
||
|
var c3t4: () => IFoo = function() { return <IFoo>({}) };
|
||
|
>c3t4 : Symbol(c3t4, Decl(contextualTyping.ts, 32, 3))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
var c3t5: (n: number) => IFoo = function(n) { return <IFoo>({}) };
|
||
|
>c3t5 : Symbol(c3t5, Decl(contextualTyping.ts, 33, 3))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 33, 11))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 33, 41))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
var c3t6: (n: number, s: string) => IFoo = function(n, s) { return <IFoo>({}) };
|
||
|
>c3t6 : Symbol(c3t6, Decl(contextualTyping.ts, 34, 3))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 34, 11))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 34, 21))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 34, 52))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 34, 54))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
var c3t7: {
|
||
|
>c3t7 : Symbol(c3t7, Decl(contextualTyping.ts, 35, 3))
|
||
|
|
||
|
(n: number): number;
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 36, 5))
|
||
|
|
||
|
(s1: string): number;
|
||
|
>s1 : Symbol(s1, Decl(contextualTyping.ts, 37, 5))
|
||
|
|
||
|
} = function(n) { return n; };
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 38, 13))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 38, 13))
|
||
|
|
||
|
var c3t8: (n: number, s: string) => number = function(n) { return n; };
|
||
|
>c3t8 : Symbol(c3t8, Decl(contextualTyping.ts, 40, 3))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 40, 11))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 40, 21))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 40, 54))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 40, 54))
|
||
|
|
||
|
var c3t9: number[][] = [[],[]];
|
||
|
>c3t9 : Symbol(c3t9, Decl(contextualTyping.ts, 41, 3))
|
||
|
|
||
|
var c3t10: IFoo[] = [<IFoo>({}),<IFoo>({})];
|
||
|
>c3t10 : Symbol(c3t10, Decl(contextualTyping.ts, 42, 3))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
var c3t11: {(n: number, s: string): string;}[] = [function(n, s) { return s; }];
|
||
|
>c3t11 : Symbol(c3t11, Decl(contextualTyping.ts, 43, 3))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 43, 13))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 43, 23))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 43, 59))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 43, 61))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 43, 61))
|
||
|
|
||
|
var c3t12: IBar = {
|
||
|
>c3t12 : Symbol(c3t12, Decl(contextualTyping.ts, 44, 3))
|
||
|
>IBar : Symbol(IBar, Decl(contextualTyping.ts, 6, 1))
|
||
|
|
||
|
foo: <IFoo>({})
|
||
|
>foo : Symbol(foo, Decl(contextualTyping.ts, 44, 19))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
}
|
||
|
var c3t13 = <IFoo>({
|
||
|
>c3t13 : Symbol(c3t13, Decl(contextualTyping.ts, 47, 3))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
f: function(i, s) { return s; }
|
||
|
>f : Symbol(f, Decl(contextualTyping.ts, 47, 20))
|
||
|
>i : Symbol(i, Decl(contextualTyping.ts, 48, 16))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 48, 18))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 48, 18))
|
||
|
|
||
|
})
|
||
|
var c3t14 = <IFoo>({
|
||
|
>c3t14 : Symbol(c3t14, Decl(contextualTyping.ts, 50, 3))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
a: []
|
||
|
>a : Symbol(a, Decl(contextualTyping.ts, 50, 20))
|
||
|
|
||
|
})
|
||
|
|
||
|
// CONTEXT: Class property assignment
|
||
|
class C4T5 {
|
||
|
>C4T5 : Symbol(C4T5, Decl(contextualTyping.ts, 52, 2))
|
||
|
|
||
|
foo: (i: number, s: string) => string;
|
||
|
>foo : Symbol(C4T5.foo, Decl(contextualTyping.ts, 55, 12))
|
||
|
>i : Symbol(i, Decl(contextualTyping.ts, 56, 10))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 56, 20))
|
||
|
|
||
|
constructor() {
|
||
|
this.foo = function(i, s) {
|
||
|
>this.foo : Symbol(C4T5.foo, Decl(contextualTyping.ts, 55, 12))
|
||
|
>this : Symbol(C4T5, Decl(contextualTyping.ts, 52, 2))
|
||
|
>foo : Symbol(C4T5.foo, Decl(contextualTyping.ts, 55, 12))
|
||
|
>i : Symbol(i, Decl(contextualTyping.ts, 58, 28))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 58, 30))
|
||
|
|
||
|
return s;
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 58, 30))
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// CONTEXT: Module property assignment
|
||
|
module C5T5 {
|
||
|
>C5T5 : Symbol(C5T5, Decl(contextualTyping.ts, 62, 1))
|
||
|
|
||
|
export var foo: (i: number, s: string) => string;
|
||
|
>foo : Symbol(foo, Decl(contextualTyping.ts, 66, 14))
|
||
|
>i : Symbol(i, Decl(contextualTyping.ts, 66, 21))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 66, 31))
|
||
|
|
||
|
foo = function(i, s) {
|
||
|
>foo : Symbol(foo, Decl(contextualTyping.ts, 66, 14))
|
||
|
>i : Symbol(i, Decl(contextualTyping.ts, 67, 19))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 67, 21))
|
||
|
|
||
|
return s;
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 67, 21))
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// CONTEXT: Variable assignment
|
||
|
var c6t5: (n: number) => IFoo;
|
||
|
>c6t5 : Symbol(c6t5, Decl(contextualTyping.ts, 73, 3))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 73, 11))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
c6t5 = <(n: number) => IFoo>function(n) { return <IFoo>({}) };
|
||
|
>c6t5 : Symbol(c6t5, Decl(contextualTyping.ts, 73, 3))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 74, 9))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 74, 37))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
// CONTEXT: Array index assignment
|
||
|
var c7t2: IFoo[];
|
||
|
>c7t2 : Symbol(c7t2, Decl(contextualTyping.ts, 77, 3))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
c7t2[0] = <IFoo>({n: 1});
|
||
|
>c7t2 : Symbol(c7t2, Decl(contextualTyping.ts, 77, 3))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 78, 18))
|
||
|
|
||
|
// CONTEXT: Object property assignment
|
||
|
interface IPlaceHolder {
|
||
|
>IPlaceHolder : Symbol(IPlaceHolder, Decl(contextualTyping.ts, 78, 25))
|
||
|
|
||
|
t1: (s: string) => string;
|
||
|
>t1 : Symbol(IPlaceHolder.t1, Decl(contextualTyping.ts, 81, 24))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 82, 9))
|
||
|
|
||
|
t2: IFoo;
|
||
|
>t2 : Symbol(IPlaceHolder.t2, Decl(contextualTyping.ts, 82, 30))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
t3: number[];
|
||
|
>t3 : Symbol(IPlaceHolder.t3, Decl(contextualTyping.ts, 83, 13))
|
||
|
|
||
|
t4: () => IFoo;
|
||
|
>t4 : Symbol(IPlaceHolder.t4, Decl(contextualTyping.ts, 84, 17))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
t5: (n: number) => IFoo;
|
||
|
>t5 : Symbol(IPlaceHolder.t5, Decl(contextualTyping.ts, 85, 19))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 86, 9))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
t6: (n: number, s: string) => IFoo;
|
||
|
>t6 : Symbol(IPlaceHolder.t6, Decl(contextualTyping.ts, 86, 28))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 87, 9))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 87, 19))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
t7: {
|
||
|
>t7 : Symbol(IPlaceHolder.t7, Decl(contextualTyping.ts, 87, 39))
|
||
|
|
||
|
(n: number, s: string): number;
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 89, 13))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 89, 23))
|
||
|
|
||
|
//(s1: string, s2: string): number;
|
||
|
};
|
||
|
t8: (n: number, s: string) => number;
|
||
|
>t8 : Symbol(IPlaceHolder.t8, Decl(contextualTyping.ts, 91, 10))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 92, 9))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 92, 19))
|
||
|
|
||
|
t9: number[][];
|
||
|
>t9 : Symbol(IPlaceHolder.t9, Decl(contextualTyping.ts, 92, 41))
|
||
|
|
||
|
t10: IFoo[];
|
||
|
>t10 : Symbol(IPlaceHolder.t10, Decl(contextualTyping.ts, 93, 19))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
t11: {(n: number, s: string): string;}[];
|
||
|
>t11 : Symbol(IPlaceHolder.t11, Decl(contextualTyping.ts, 94, 16))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 95, 11))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 95, 21))
|
||
|
|
||
|
t12: IBar;
|
||
|
>t12 : Symbol(IPlaceHolder.t12, Decl(contextualTyping.ts, 95, 45))
|
||
|
>IBar : Symbol(IBar, Decl(contextualTyping.ts, 6, 1))
|
||
|
|
||
|
t13: IFoo;
|
||
|
>t13 : Symbol(IPlaceHolder.t13, Decl(contextualTyping.ts, 96, 14))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
t14: IFoo;
|
||
|
>t14 : Symbol(IPlaceHolder.t14, Decl(contextualTyping.ts, 97, 14))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
}
|
||
|
|
||
|
var objc8: {
|
||
|
>objc8 : Symbol(objc8, Decl(contextualTyping.ts, 101, 3))
|
||
|
|
||
|
t1: (s: string) => string;
|
||
|
>t1 : Symbol(t1, Decl(contextualTyping.ts, 101, 12))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 102, 9))
|
||
|
|
||
|
t2: IFoo;
|
||
|
>t2 : Symbol(t2, Decl(contextualTyping.ts, 102, 30))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
t3: number[];
|
||
|
>t3 : Symbol(t3, Decl(contextualTyping.ts, 103, 13))
|
||
|
|
||
|
t4: () => IFoo;
|
||
|
>t4 : Symbol(t4, Decl(contextualTyping.ts, 104, 17))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
t5: (n: number) => IFoo;
|
||
|
>t5 : Symbol(t5, Decl(contextualTyping.ts, 105, 19))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 106, 9))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
t6: (n: number, s: string) => IFoo;
|
||
|
>t6 : Symbol(t6, Decl(contextualTyping.ts, 106, 28))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 107, 9))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 107, 19))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
t7: {
|
||
|
>t7 : Symbol(t7, Decl(contextualTyping.ts, 107, 39))
|
||
|
|
||
|
(n: number, s: string): number;
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 109, 13))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 109, 23))
|
||
|
|
||
|
//(s1: string, s2: string): number;
|
||
|
};
|
||
|
t8: (n: number, s: string) => number;
|
||
|
>t8 : Symbol(t8, Decl(contextualTyping.ts, 111, 10))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 112, 9))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 112, 19))
|
||
|
|
||
|
t9: number[][];
|
||
|
>t9 : Symbol(t9, Decl(contextualTyping.ts, 112, 41))
|
||
|
|
||
|
t10: IFoo[];
|
||
|
>t10 : Symbol(t10, Decl(contextualTyping.ts, 113, 19))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
t11: {(n: number, s: string): string;}[];
|
||
|
>t11 : Symbol(t11, Decl(contextualTyping.ts, 114, 16))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 115, 11))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 115, 21))
|
||
|
|
||
|
t12: IBar;
|
||
|
>t12 : Symbol(t12, Decl(contextualTyping.ts, 115, 45))
|
||
|
>IBar : Symbol(IBar, Decl(contextualTyping.ts, 6, 1))
|
||
|
|
||
|
t13: IFoo;
|
||
|
>t13 : Symbol(t13, Decl(contextualTyping.ts, 116, 14))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
t14: IFoo;
|
||
|
>t14 : Symbol(t14, Decl(contextualTyping.ts, 117, 14))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
} = <IPlaceHolder>({});
|
||
|
>IPlaceHolder : Symbol(IPlaceHolder, Decl(contextualTyping.ts, 78, 25))
|
||
|
|
||
|
objc8.t1 = (function(s) { return s });
|
||
|
>objc8.t1 : Symbol(t1, Decl(contextualTyping.ts, 101, 12))
|
||
|
>objc8 : Symbol(objc8, Decl(contextualTyping.ts, 101, 3))
|
||
|
>t1 : Symbol(t1, Decl(contextualTyping.ts, 101, 12))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 121, 21))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 121, 21))
|
||
|
|
||
|
objc8.t2 = <IFoo>({
|
||
|
>objc8.t2 : Symbol(t2, Decl(contextualTyping.ts, 102, 30))
|
||
|
>objc8 : Symbol(objc8, Decl(contextualTyping.ts, 101, 3))
|
||
|
>t2 : Symbol(t2, Decl(contextualTyping.ts, 102, 30))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
n: 1
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 122, 19))
|
||
|
|
||
|
});
|
||
|
objc8.t3 = [];
|
||
|
>objc8.t3 : Symbol(t3, Decl(contextualTyping.ts, 103, 13))
|
||
|
>objc8 : Symbol(objc8, Decl(contextualTyping.ts, 101, 3))
|
||
|
>t3 : Symbol(t3, Decl(contextualTyping.ts, 103, 13))
|
||
|
|
||
|
objc8.t4 = function() { return <IFoo>({}) };
|
||
|
>objc8.t4 : Symbol(t4, Decl(contextualTyping.ts, 104, 17))
|
||
|
>objc8 : Symbol(objc8, Decl(contextualTyping.ts, 101, 3))
|
||
|
>t4 : Symbol(t4, Decl(contextualTyping.ts, 104, 17))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
objc8.t5 = function(n) { return <IFoo>({}) };
|
||
|
>objc8.t5 : Symbol(t5, Decl(contextualTyping.ts, 105, 19))
|
||
|
>objc8 : Symbol(objc8, Decl(contextualTyping.ts, 101, 3))
|
||
|
>t5 : Symbol(t5, Decl(contextualTyping.ts, 105, 19))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 127, 20))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
objc8.t6 = function(n, s) { return <IFoo>({}) };
|
||
|
>objc8.t6 : Symbol(t6, Decl(contextualTyping.ts, 106, 28))
|
||
|
>objc8 : Symbol(objc8, Decl(contextualTyping.ts, 101, 3))
|
||
|
>t6 : Symbol(t6, Decl(contextualTyping.ts, 106, 28))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 128, 20))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 128, 22))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
objc8.t7 = function(n: number) { return n };
|
||
|
>objc8.t7 : Symbol(t7, Decl(contextualTyping.ts, 107, 39))
|
||
|
>objc8 : Symbol(objc8, Decl(contextualTyping.ts, 101, 3))
|
||
|
>t7 : Symbol(t7, Decl(contextualTyping.ts, 107, 39))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 129, 20))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 129, 20))
|
||
|
|
||
|
objc8.t8 = function(n) { return n; };
|
||
|
>objc8.t8 : Symbol(t8, Decl(contextualTyping.ts, 111, 10))
|
||
|
>objc8 : Symbol(objc8, Decl(contextualTyping.ts, 101, 3))
|
||
|
>t8 : Symbol(t8, Decl(contextualTyping.ts, 111, 10))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 131, 20))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 131, 20))
|
||
|
|
||
|
objc8.t9 = [[],[]];
|
||
|
>objc8.t9 : Symbol(t9, Decl(contextualTyping.ts, 112, 41))
|
||
|
>objc8 : Symbol(objc8, Decl(contextualTyping.ts, 101, 3))
|
||
|
>t9 : Symbol(t9, Decl(contextualTyping.ts, 112, 41))
|
||
|
|
||
|
objc8.t10 = [<IFoo>({}),<IFoo>({})];
|
||
|
>objc8.t10 : Symbol(t10, Decl(contextualTyping.ts, 113, 19))
|
||
|
>objc8 : Symbol(objc8, Decl(contextualTyping.ts, 101, 3))
|
||
|
>t10 : Symbol(t10, Decl(contextualTyping.ts, 113, 19))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
objc8.t11 = [function(n, s) { return s; }];
|
||
|
>objc8.t11 : Symbol(t11, Decl(contextualTyping.ts, 114, 16))
|
||
|
>objc8 : Symbol(objc8, Decl(contextualTyping.ts, 101, 3))
|
||
|
>t11 : Symbol(t11, Decl(contextualTyping.ts, 114, 16))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 134, 22))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 134, 24))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 134, 24))
|
||
|
|
||
|
objc8.t12 = {
|
||
|
>objc8.t12 : Symbol(t12, Decl(contextualTyping.ts, 115, 45))
|
||
|
>objc8 : Symbol(objc8, Decl(contextualTyping.ts, 101, 3))
|
||
|
>t12 : Symbol(t12, Decl(contextualTyping.ts, 115, 45))
|
||
|
|
||
|
foo: <IFoo>({})
|
||
|
>foo : Symbol(foo, Decl(contextualTyping.ts, 135, 13))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
}
|
||
|
objc8.t13 = <IFoo>({
|
||
|
>objc8.t13 : Symbol(t13, Decl(contextualTyping.ts, 116, 14))
|
||
|
>objc8 : Symbol(objc8, Decl(contextualTyping.ts, 101, 3))
|
||
|
>t13 : Symbol(t13, Decl(contextualTyping.ts, 116, 14))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
f: function(i, s) { return s; }
|
||
|
>f : Symbol(f, Decl(contextualTyping.ts, 138, 20))
|
||
|
>i : Symbol(i, Decl(contextualTyping.ts, 139, 16))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 139, 18))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 139, 18))
|
||
|
|
||
|
})
|
||
|
objc8.t14 = <IFoo>({
|
||
|
>objc8.t14 : Symbol(t14, Decl(contextualTyping.ts, 117, 14))
|
||
|
>objc8 : Symbol(objc8, Decl(contextualTyping.ts, 101, 3))
|
||
|
>t14 : Symbol(t14, Decl(contextualTyping.ts, 117, 14))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
a: []
|
||
|
>a : Symbol(a, Decl(contextualTyping.ts, 141, 20))
|
||
|
|
||
|
})
|
||
|
// CONTEXT: Function call
|
||
|
function c9t5(f: (n: number) => IFoo) {};
|
||
|
>c9t5 : Symbol(c9t5, Decl(contextualTyping.ts, 143, 2))
|
||
|
>f : Symbol(f, Decl(contextualTyping.ts, 145, 14))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 145, 18))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
c9t5(function(n) {
|
||
|
>c9t5 : Symbol(c9t5, Decl(contextualTyping.ts, 143, 2))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 146, 14))
|
||
|
|
||
|
return <IFoo>({});
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
});
|
||
|
|
||
|
// CONTEXT: Return statement
|
||
|
var c10t5: () => (n: number) => IFoo = function() { return function(n) { return <IFoo>({}) } };
|
||
|
>c10t5 : Symbol(c10t5, Decl(contextualTyping.ts, 151, 3))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 151, 18))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 151, 68))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
// CONTEXT: Newing a class
|
||
|
class C11t5 { constructor(f: (n: number) => IFoo) { } };
|
||
|
>C11t5 : Symbol(C11t5, Decl(contextualTyping.ts, 151, 95))
|
||
|
>f : Symbol(f, Decl(contextualTyping.ts, 154, 26))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 154, 30))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
var i = new C11t5(function(n) { return <IFoo>({}) });
|
||
|
>i : Symbol(i, Decl(contextualTyping.ts, 155, 3))
|
||
|
>C11t5 : Symbol(C11t5, Decl(contextualTyping.ts, 151, 95))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 155, 27))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
// CONTEXT: Type annotated expression
|
||
|
var c12t1 = <(s: string) => string> (function(s) { return s });
|
||
|
>c12t1 : Symbol(c12t1, Decl(contextualTyping.ts, 158, 3))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 158, 14))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 158, 46))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 158, 46))
|
||
|
|
||
|
var c12t2 = <IFoo> ({
|
||
|
>c12t2 : Symbol(c12t2, Decl(contextualTyping.ts, 159, 3))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
n: 1
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 159, 21))
|
||
|
|
||
|
});
|
||
|
var c12t3 = <number[]> [];
|
||
|
>c12t3 : Symbol(c12t3, Decl(contextualTyping.ts, 162, 3))
|
||
|
|
||
|
var c12t4 = <() => IFoo> function() { return <IFoo>({}) };
|
||
|
>c12t4 : Symbol(c12t4, Decl(contextualTyping.ts, 163, 3))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
var c12t5 = <(n: number) => IFoo> function(n) { return <IFoo>({}) };
|
||
|
>c12t5 : Symbol(c12t5, Decl(contextualTyping.ts, 164, 3))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 164, 14))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 164, 43))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
var c12t6 = <(n: number, s: string) => IFoo> function(n, s) { return <IFoo>({}) };
|
||
|
>c12t6 : Symbol(c12t6, Decl(contextualTyping.ts, 165, 3))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 165, 14))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 165, 24))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 165, 54))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 165, 56))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
var c12t7 = <{
|
||
|
>c12t7 : Symbol(c12t7, Decl(contextualTyping.ts, 166, 3))
|
||
|
|
||
|
(n: number, s: string): number;
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 167, 5))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 167, 15))
|
||
|
|
||
|
//(s1: string, s2: string): number;
|
||
|
}> function(n:number) { return n };
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 169, 12))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 169, 12))
|
||
|
|
||
|
var c12t8 = <(n: number, s: string) => number> function(n) { return n; };
|
||
|
>c12t8 : Symbol(c12t8, Decl(contextualTyping.ts, 171, 3))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 171, 14))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 171, 24))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 171, 56))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 171, 56))
|
||
|
|
||
|
var c12t9 = <number[][]> [[],[]];
|
||
|
>c12t9 : Symbol(c12t9, Decl(contextualTyping.ts, 172, 3))
|
||
|
|
||
|
var c12t10 = <IFoo[]> [<IFoo>({}),<IFoo>({})];
|
||
|
>c12t10 : Symbol(c12t10, Decl(contextualTyping.ts, 173, 3))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
var c12t11 = <{(n: number, s: string): string;}[]> [function(n, s) { return s; }];
|
||
|
>c12t11 : Symbol(c12t11, Decl(contextualTyping.ts, 174, 3))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 174, 16))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 174, 26))
|
||
|
>n : Symbol(n, Decl(contextualTyping.ts, 174, 61))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 174, 63))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 174, 63))
|
||
|
|
||
|
var c12t12 = <IBar> {
|
||
|
>c12t12 : Symbol(c12t12, Decl(contextualTyping.ts, 175, 3))
|
||
|
>IBar : Symbol(IBar, Decl(contextualTyping.ts, 6, 1))
|
||
|
|
||
|
foo: <IFoo>({})
|
||
|
>foo : Symbol(foo, Decl(contextualTyping.ts, 175, 21))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
}
|
||
|
var c12t13 = <IFoo> ({
|
||
|
>c12t13 : Symbol(c12t13, Decl(contextualTyping.ts, 178, 3))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
f: function(i, s) { return s; }
|
||
|
>f : Symbol(f, Decl(contextualTyping.ts, 178, 22))
|
||
|
>i : Symbol(i, Decl(contextualTyping.ts, 179, 16))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 179, 18))
|
||
|
>s : Symbol(s, Decl(contextualTyping.ts, 179, 18))
|
||
|
|
||
|
})
|
||
|
var c12t14 = <IFoo> ({
|
||
|
>c12t14 : Symbol(c12t14, Decl(contextualTyping.ts, 181, 3))
|
||
|
>IFoo : Symbol(IFoo, Decl(contextualTyping.ts, 0, 0))
|
||
|
|
||
|
a: []
|
||
|
>a : Symbol(a, Decl(contextualTyping.ts, 181, 22))
|
||
|
|
||
|
})
|
||
|
|
||
|
// CONTEXT: Contextual typing declarations
|
||
|
|
||
|
// contextually typing function declarations
|
||
|
declare function EF1(a:number, b:number):number;
|
||
|
>EF1 : Symbol(EF1, Decl(contextualTyping.ts, 183, 2), Decl(contextualTyping.ts, 188, 48))
|
||
|
>a : Symbol(a, Decl(contextualTyping.ts, 188, 21))
|
||
|
>b : Symbol(b, Decl(contextualTyping.ts, 188, 30))
|
||
|
|
||
|
function EF1(a,b) { return a+b; }
|
||
|
>EF1 : Symbol(EF1, Decl(contextualTyping.ts, 183, 2), Decl(contextualTyping.ts, 188, 48))
|
||
|
>a : Symbol(a, Decl(contextualTyping.ts, 190, 13))
|
||
|
>b : Symbol(b, Decl(contextualTyping.ts, 190, 15))
|
||
|
>a : Symbol(a, Decl(contextualTyping.ts, 190, 13))
|
||
|
>b : Symbol(b, Decl(contextualTyping.ts, 190, 15))
|
||
|
|
||
|
var efv = EF1(1,2);
|
||
|
>efv : Symbol(efv, Decl(contextualTyping.ts, 192, 3))
|
||
|
>EF1 : Symbol(EF1, Decl(contextualTyping.ts, 183, 2), Decl(contextualTyping.ts, 188, 48))
|
||
|
|
||
|
|
||
|
// contextually typing from ambient class declarations
|
||
|
declare class Point
|
||
|
>Point : Symbol(Point, Decl(contextualTyping.ts, 192, 19))
|
||
|
{
|
||
|
constructor(x: number, y: number);
|
||
|
>x : Symbol(x, Decl(contextualTyping.ts, 198, 18))
|
||
|
>y : Symbol(y, Decl(contextualTyping.ts, 198, 28))
|
||
|
|
||
|
x: number;
|
||
|
>x : Symbol(Point.x, Decl(contextualTyping.ts, 198, 40))
|
||
|
|
||
|
y: number;
|
||
|
>y : Symbol(Point.y, Decl(contextualTyping.ts, 199, 16))
|
||
|
|
||
|
add(dx: number, dy: number): Point;
|
||
|
>add : Symbol(Point.add, Decl(contextualTyping.ts, 200, 16))
|
||
|
>dx : Symbol(dx, Decl(contextualTyping.ts, 201, 10))
|
||
|
>dy : Symbol(dy, Decl(contextualTyping.ts, 201, 21))
|
||
|
>Point : Symbol(Point, Decl(contextualTyping.ts, 192, 19))
|
||
|
|
||
|
static origin: Point;
|
||
|
>origin : Symbol(Point.origin, Decl(contextualTyping.ts, 201, 41))
|
||
|
>Point : Symbol(Point, Decl(contextualTyping.ts, 192, 19))
|
||
|
|
||
|
}
|
||
|
|
||
|
function Point(x, y) {
|
||
|
>Point : Symbol(Point, Decl(contextualTyping.ts, 204, 1))
|
||
|
>x : Symbol(x, Decl(contextualTyping.ts, 206, 15))
|
||
|
>y : Symbol(y, Decl(contextualTyping.ts, 206, 17))
|
||
|
|
||
|
this.x = x;
|
||
|
>x : Symbol(x, Decl(contextualTyping.ts, 206, 15))
|
||
|
|
||
|
this.y = y;
|
||
|
>y : Symbol(y, Decl(contextualTyping.ts, 206, 17))
|
||
|
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
Point.origin = new Point(0, 0);
|
||
|
>Point.origin : Symbol(Point.origin, Decl(contextualTyping.ts, 201, 41))
|
||
|
>Point : Symbol(Point, Decl(contextualTyping.ts, 192, 19))
|
||
|
>origin : Symbol(Point.origin, Decl(contextualTyping.ts, 201, 41))
|
||
|
>Point : Symbol(Point, Decl(contextualTyping.ts, 192, 19))
|
||
|
|
||
|
Point.prototype.add = function(dx, dy) {
|
||
|
>Point.prototype.add : Symbol(Point.add, Decl(contextualTyping.ts, 200, 16))
|
||
|
>Point.prototype : Symbol(Point.prototype)
|
||
|
>Point : Symbol(Point, Decl(contextualTyping.ts, 192, 19))
|
||
|
>prototype : Symbol(Point.prototype)
|
||
|
>add : Symbol(Point.add, Decl(contextualTyping.ts, 200, 16))
|
||
|
>dx : Symbol(dx, Decl(contextualTyping.ts, 215, 31))
|
||
|
>dy : Symbol(dy, Decl(contextualTyping.ts, 215, 34))
|
||
|
|
||
|
return new Point(this.x + dx, this.y + dy);
|
||
|
>Point : Symbol(Point, Decl(contextualTyping.ts, 192, 19))
|
||
|
>dx : Symbol(dx, Decl(contextualTyping.ts, 215, 31))
|
||
|
>dy : Symbol(dy, Decl(contextualTyping.ts, 215, 34))
|
||
|
|
||
|
};
|
||
|
|
||
|
Point.prototype = {
|
||
|
>Point.prototype : Symbol(Point.prototype)
|
||
|
>Point : Symbol(Point, Decl(contextualTyping.ts, 192, 19))
|
||
|
>prototype : Symbol(Point.prototype)
|
||
|
|
||
|
x: 0,
|
||
|
>x : Symbol(x, Decl(contextualTyping.ts, 219, 19))
|
||
|
|
||
|
y: 0,
|
||
|
>y : Symbol(y, Decl(contextualTyping.ts, 220, 9))
|
||
|
|
||
|
add: function(dx, dy) {
|
||
|
>add : Symbol(add, Decl(contextualTyping.ts, 221, 9))
|
||
|
>dx : Symbol(dx, Decl(contextualTyping.ts, 222, 18))
|
||
|
>dy : Symbol(dy, Decl(contextualTyping.ts, 222, 21))
|
||
|
|
||
|
return new Point(this.x + dx, this.y + dy);
|
||
|
>Point : Symbol(Point, Decl(contextualTyping.ts, 192, 19))
|
||
|
>dx : Symbol(dx, Decl(contextualTyping.ts, 222, 18))
|
||
|
>dy : Symbol(dy, Decl(contextualTyping.ts, 222, 21))
|
||
|
}
|
||
|
};
|
||
|
|
||
|
interface A { x: string; }
|
||
|
>A : Symbol(A, Decl(contextualTyping.ts, 225, 2))
|
||
|
>x : Symbol(A.x, Decl(contextualTyping.ts, 227, 13))
|
||
|
|
||
|
interface B extends A { }
|
||
|
>B : Symbol(B, Decl(contextualTyping.ts, 227, 26))
|
||
|
>A : Symbol(A, Decl(contextualTyping.ts, 225, 2))
|
||
|
|
||
|
var x: B = { };
|
||
|
>x : Symbol(x, Decl(contextualTyping.ts, 229, 3))
|
||
|
>B : Symbol(B, Decl(contextualTyping.ts, 227, 26))
|
||
|
|