Add test
This commit is contained in:
parent
8eb1ecb44f
commit
04b4bc26b2
4 changed files with 188 additions and 0 deletions
|
@ -0,0 +1,39 @@
|
|||
//// [cyclicGenericTypeInstantiationInference.ts]
|
||||
function foo<T>() {
|
||||
var z = foo<typeof y>();
|
||||
var y: {
|
||||
y2: typeof z
|
||||
};
|
||||
return y;
|
||||
}
|
||||
|
||||
|
||||
function bar<T>() {
|
||||
var z = bar<typeof y>();
|
||||
var y: {
|
||||
y2: typeof z;
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
var a = foo<number>();
|
||||
var b = bar<number>();
|
||||
|
||||
function test<T>(x: typeof a): void { }
|
||||
test(b);
|
||||
|
||||
//// [cyclicGenericTypeInstantiationInference.js]
|
||||
function foo() {
|
||||
var z = foo();
|
||||
var y;
|
||||
return y;
|
||||
}
|
||||
function bar() {
|
||||
var z = bar();
|
||||
var y;
|
||||
return y;
|
||||
}
|
||||
var a = foo();
|
||||
var b = bar();
|
||||
function test(x) { }
|
||||
test(b);
|
|
@ -0,0 +1,61 @@
|
|||
=== tests/cases/compiler/cyclicGenericTypeInstantiationInference.ts ===
|
||||
function foo<T>() {
|
||||
>foo : Symbol(foo, Decl(cyclicGenericTypeInstantiationInference.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(cyclicGenericTypeInstantiationInference.ts, 0, 13))
|
||||
|
||||
var z = foo<typeof y>();
|
||||
>z : Symbol(z, Decl(cyclicGenericTypeInstantiationInference.ts, 1, 7))
|
||||
>foo : Symbol(foo, Decl(cyclicGenericTypeInstantiationInference.ts, 0, 0))
|
||||
>y : Symbol(y, Decl(cyclicGenericTypeInstantiationInference.ts, 2, 7))
|
||||
|
||||
var y: {
|
||||
>y : Symbol(y, Decl(cyclicGenericTypeInstantiationInference.ts, 2, 7))
|
||||
|
||||
y2: typeof z
|
||||
>y2 : Symbol(y2, Decl(cyclicGenericTypeInstantiationInference.ts, 2, 12))
|
||||
>z : Symbol(z, Decl(cyclicGenericTypeInstantiationInference.ts, 1, 7))
|
||||
|
||||
};
|
||||
return y;
|
||||
>y : Symbol(y, Decl(cyclicGenericTypeInstantiationInference.ts, 2, 7))
|
||||
}
|
||||
|
||||
|
||||
function bar<T>() {
|
||||
>bar : Symbol(bar, Decl(cyclicGenericTypeInstantiationInference.ts, 6, 1))
|
||||
>T : Symbol(T, Decl(cyclicGenericTypeInstantiationInference.ts, 9, 13))
|
||||
|
||||
var z = bar<typeof y>();
|
||||
>z : Symbol(z, Decl(cyclicGenericTypeInstantiationInference.ts, 10, 7))
|
||||
>bar : Symbol(bar, Decl(cyclicGenericTypeInstantiationInference.ts, 6, 1))
|
||||
>y : Symbol(y, Decl(cyclicGenericTypeInstantiationInference.ts, 11, 7))
|
||||
|
||||
var y: {
|
||||
>y : Symbol(y, Decl(cyclicGenericTypeInstantiationInference.ts, 11, 7))
|
||||
|
||||
y2: typeof z;
|
||||
>y2 : Symbol(y2, Decl(cyclicGenericTypeInstantiationInference.ts, 11, 12))
|
||||
>z : Symbol(z, Decl(cyclicGenericTypeInstantiationInference.ts, 10, 7))
|
||||
}
|
||||
return y;
|
||||
>y : Symbol(y, Decl(cyclicGenericTypeInstantiationInference.ts, 11, 7))
|
||||
}
|
||||
|
||||
var a = foo<number>();
|
||||
>a : Symbol(a, Decl(cyclicGenericTypeInstantiationInference.ts, 17, 3))
|
||||
>foo : Symbol(foo, Decl(cyclicGenericTypeInstantiationInference.ts, 0, 0))
|
||||
|
||||
var b = bar<number>();
|
||||
>b : Symbol(b, Decl(cyclicGenericTypeInstantiationInference.ts, 18, 3))
|
||||
>bar : Symbol(bar, Decl(cyclicGenericTypeInstantiationInference.ts, 6, 1))
|
||||
|
||||
function test<T>(x: typeof a): void { }
|
||||
>test : Symbol(test, Decl(cyclicGenericTypeInstantiationInference.ts, 18, 22))
|
||||
>T : Symbol(T, Decl(cyclicGenericTypeInstantiationInference.ts, 20, 14))
|
||||
>x : Symbol(x, Decl(cyclicGenericTypeInstantiationInference.ts, 20, 17))
|
||||
>a : Symbol(a, Decl(cyclicGenericTypeInstantiationInference.ts, 17, 3))
|
||||
|
||||
test(b);
|
||||
>test : Symbol(test, Decl(cyclicGenericTypeInstantiationInference.ts, 18, 22))
|
||||
>b : Symbol(b, Decl(cyclicGenericTypeInstantiationInference.ts, 18, 3))
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
=== tests/cases/compiler/cyclicGenericTypeInstantiationInference.ts ===
|
||||
function foo<T>() {
|
||||
>foo : <T>() => { y2: any; }
|
||||
>T : T
|
||||
|
||||
var z = foo<typeof y>();
|
||||
>z : { y2: any; }
|
||||
>foo<typeof y>() : { y2: any; }
|
||||
>foo : <T>() => { y2: any; }
|
||||
>y : { y2: any; }
|
||||
|
||||
var y: {
|
||||
>y : { y2: any; }
|
||||
|
||||
y2: typeof z
|
||||
>y2 : { y2: any; }
|
||||
>z : { y2: any; }
|
||||
|
||||
};
|
||||
return y;
|
||||
>y : { y2: any; }
|
||||
}
|
||||
|
||||
|
||||
function bar<T>() {
|
||||
>bar : <T>() => { y2: any; }
|
||||
>T : T
|
||||
|
||||
var z = bar<typeof y>();
|
||||
>z : { y2: any; }
|
||||
>bar<typeof y>() : { y2: any; }
|
||||
>bar : <T>() => { y2: any; }
|
||||
>y : { y2: any; }
|
||||
|
||||
var y: {
|
||||
>y : { y2: any; }
|
||||
|
||||
y2: typeof z;
|
||||
>y2 : { y2: any; }
|
||||
>z : { y2: any; }
|
||||
}
|
||||
return y;
|
||||
>y : { y2: any; }
|
||||
}
|
||||
|
||||
var a = foo<number>();
|
||||
>a : { y2: any; }
|
||||
>foo<number>() : { y2: any; }
|
||||
>foo : <T>() => { y2: any; }
|
||||
|
||||
var b = bar<number>();
|
||||
>b : { y2: any; }
|
||||
>bar<number>() : { y2: any; }
|
||||
>bar : <T>() => { y2: any; }
|
||||
|
||||
function test<T>(x: typeof a): void { }
|
||||
>test : <T>(x: { y2: any; }) => void
|
||||
>T : T
|
||||
>x : { y2: any; }
|
||||
>a : { y2: any; }
|
||||
|
||||
test(b);
|
||||
>test(b) : void
|
||||
>test : <T>(x: { y2: any; }) => void
|
||||
>b : { y2: any; }
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
function foo<T>() {
|
||||
var z = foo<typeof y>();
|
||||
var y: {
|
||||
y2: typeof z
|
||||
};
|
||||
return y;
|
||||
}
|
||||
|
||||
|
||||
function bar<T>() {
|
||||
var z = bar<typeof y>();
|
||||
var y: {
|
||||
y2: typeof z;
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
var a = foo<number>();
|
||||
var b = bar<number>();
|
||||
|
||||
function test<T>(x: typeof a): void { }
|
||||
test(b);
|
Loading…
Reference in a new issue