Adding regression test

This commit is contained in:
Anders Hejlsberg 2015-05-30 18:09:13 -07:00
parent 46e0ba82ce
commit e336e3ad0a
4 changed files with 172 additions and 0 deletions

View File

@ -0,0 +1,37 @@
//// [cyclicGenericTypeInstantiation.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>();
a = b;
//// [cyclicGenericTypeInstantiation.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();
a = b;

View File

@ -0,0 +1,55 @@
=== tests/cases/compiler/cyclicGenericTypeInstantiation.ts ===
function foo<T>() {
>foo : Symbol(foo, Decl(cyclicGenericTypeInstantiation.ts, 0, 0))
>T : Symbol(T, Decl(cyclicGenericTypeInstantiation.ts, 0, 13))
var z = foo<typeof y>();
>z : Symbol(z, Decl(cyclicGenericTypeInstantiation.ts, 1, 7))
>foo : Symbol(foo, Decl(cyclicGenericTypeInstantiation.ts, 0, 0))
>y : Symbol(y, Decl(cyclicGenericTypeInstantiation.ts, 2, 7))
var y: {
>y : Symbol(y, Decl(cyclicGenericTypeInstantiation.ts, 2, 7))
y2: typeof z
>y2 : Symbol(y2, Decl(cyclicGenericTypeInstantiation.ts, 2, 12))
>z : Symbol(z, Decl(cyclicGenericTypeInstantiation.ts, 1, 7))
};
return y;
>y : Symbol(y, Decl(cyclicGenericTypeInstantiation.ts, 2, 7))
}
function bar<T>() {
>bar : Symbol(bar, Decl(cyclicGenericTypeInstantiation.ts, 6, 1))
>T : Symbol(T, Decl(cyclicGenericTypeInstantiation.ts, 9, 13))
var z = bar<typeof y>();
>z : Symbol(z, Decl(cyclicGenericTypeInstantiation.ts, 10, 7))
>bar : Symbol(bar, Decl(cyclicGenericTypeInstantiation.ts, 6, 1))
>y : Symbol(y, Decl(cyclicGenericTypeInstantiation.ts, 11, 7))
var y: {
>y : Symbol(y, Decl(cyclicGenericTypeInstantiation.ts, 11, 7))
y2: typeof z;
>y2 : Symbol(y2, Decl(cyclicGenericTypeInstantiation.ts, 11, 12))
>z : Symbol(z, Decl(cyclicGenericTypeInstantiation.ts, 10, 7))
}
return y;
>y : Symbol(y, Decl(cyclicGenericTypeInstantiation.ts, 11, 7))
}
var a = foo<number>();
>a : Symbol(a, Decl(cyclicGenericTypeInstantiation.ts, 17, 3))
>foo : Symbol(foo, Decl(cyclicGenericTypeInstantiation.ts, 0, 0))
var b = bar<number>();
>b : Symbol(b, Decl(cyclicGenericTypeInstantiation.ts, 18, 3))
>bar : Symbol(bar, Decl(cyclicGenericTypeInstantiation.ts, 6, 1))
a = b;
>a : Symbol(a, Decl(cyclicGenericTypeInstantiation.ts, 17, 3))
>b : Symbol(b, Decl(cyclicGenericTypeInstantiation.ts, 18, 3))

View File

@ -0,0 +1,60 @@
=== tests/cases/compiler/cyclicGenericTypeInstantiation.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; }
a = b;
>a = b : { y2: any; }
>a : { y2: any; }
>b : { y2: any; }

View File

@ -0,0 +1,20 @@
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>();
a = b;