diff --git a/tests/baselines/reference/cyclicGenericTypeInstantiationInference.js b/tests/baselines/reference/cyclicGenericTypeInstantiationInference.js new file mode 100644 index 0000000000..4e093fecf7 --- /dev/null +++ b/tests/baselines/reference/cyclicGenericTypeInstantiationInference.js @@ -0,0 +1,39 @@ +//// [cyclicGenericTypeInstantiationInference.ts] +function foo() { + var z = foo(); + var y: { + y2: typeof z + }; + return y; +} + + +function bar() { + var z = bar(); + var y: { + y2: typeof z; + } + return y; +} + +var a = foo(); +var b = bar(); + +function test(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); diff --git a/tests/baselines/reference/cyclicGenericTypeInstantiationInference.symbols b/tests/baselines/reference/cyclicGenericTypeInstantiationInference.symbols new file mode 100644 index 0000000000..962a1e12cc --- /dev/null +++ b/tests/baselines/reference/cyclicGenericTypeInstantiationInference.symbols @@ -0,0 +1,61 @@ +=== tests/cases/compiler/cyclicGenericTypeInstantiationInference.ts === +function foo() { +>foo : Symbol(foo, Decl(cyclicGenericTypeInstantiationInference.ts, 0, 0)) +>T : Symbol(T, Decl(cyclicGenericTypeInstantiationInference.ts, 0, 13)) + + var z = foo(); +>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() { +>bar : Symbol(bar, Decl(cyclicGenericTypeInstantiationInference.ts, 6, 1)) +>T : Symbol(T, Decl(cyclicGenericTypeInstantiationInference.ts, 9, 13)) + + var z = bar(); +>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(); +>a : Symbol(a, Decl(cyclicGenericTypeInstantiationInference.ts, 17, 3)) +>foo : Symbol(foo, Decl(cyclicGenericTypeInstantiationInference.ts, 0, 0)) + +var b = bar(); +>b : Symbol(b, Decl(cyclicGenericTypeInstantiationInference.ts, 18, 3)) +>bar : Symbol(bar, Decl(cyclicGenericTypeInstantiationInference.ts, 6, 1)) + +function test(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)) + diff --git a/tests/baselines/reference/cyclicGenericTypeInstantiationInference.types b/tests/baselines/reference/cyclicGenericTypeInstantiationInference.types new file mode 100644 index 0000000000..765e834971 --- /dev/null +++ b/tests/baselines/reference/cyclicGenericTypeInstantiationInference.types @@ -0,0 +1,66 @@ +=== tests/cases/compiler/cyclicGenericTypeInstantiationInference.ts === +function foo() { +>foo : () => { y2: any; } +>T : T + + var z = foo(); +>z : { y2: any; } +>foo() : { y2: any; } +>foo : () => { 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() { +>bar : () => { y2: any; } +>T : T + + var z = bar(); +>z : { y2: any; } +>bar() : { y2: any; } +>bar : () => { 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(); +>a : { y2: any; } +>foo() : { y2: any; } +>foo : () => { y2: any; } + +var b = bar(); +>b : { y2: any; } +>bar() : { y2: any; } +>bar : () => { y2: any; } + +function test(x: typeof a): void { } +>test : (x: { y2: any; }) => void +>T : T +>x : { y2: any; } +>a : { y2: any; } + +test(b); +>test(b) : void +>test : (x: { y2: any; }) => void +>b : { y2: any; } + diff --git a/tests/cases/compiler/cyclicGenericTypeInstantiationInference.ts b/tests/cases/compiler/cyclicGenericTypeInstantiationInference.ts new file mode 100644 index 0000000000..92bc664a44 --- /dev/null +++ b/tests/cases/compiler/cyclicGenericTypeInstantiationInference.ts @@ -0,0 +1,22 @@ +function foo() { + var z = foo(); + var y: { + y2: typeof z + }; + return y; +} + + +function bar() { + var z = bar(); + var y: { + y2: typeof z; + } + return y; +} + +var a = foo(); +var b = bar(); + +function test(x: typeof a): void { } +test(b); \ No newline at end of file