mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Adding regression test
This commit is contained in:
parent
46e0ba82ce
commit
e336e3ad0a
37
tests/baselines/reference/cyclicGenericTypeInstantiation.js
Normal file
37
tests/baselines/reference/cyclicGenericTypeInstantiation.js
Normal 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;
|
||||
@ -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))
|
||||
|
||||
@ -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; }
|
||||
|
||||
20
tests/cases/compiler/cyclicGenericTypeInstantiation.ts
Normal file
20
tests/cases/compiler/cyclicGenericTypeInstantiation.ts
Normal 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;
|
||||
Loading…
x
Reference in New Issue
Block a user