|
| 1 | +=== tests/cases/compiler/cyclicTypeInstantiation.ts === |
| 2 | +function foo<T>() { |
| 3 | +>foo : Symbol(foo, Decl(cyclicTypeInstantiation.ts, 0, 0)) |
| 4 | +>T : Symbol(T, Decl(cyclicTypeInstantiation.ts, 0, 13)) |
| 5 | + |
| 6 | + var x: { |
| 7 | +>x : Symbol(x, Decl(cyclicTypeInstantiation.ts, 1, 7)) |
| 8 | + |
| 9 | + a: T; |
| 10 | +>a : Symbol(a, Decl(cyclicTypeInstantiation.ts, 1, 12)) |
| 11 | +>T : Symbol(T, Decl(cyclicTypeInstantiation.ts, 0, 13)) |
| 12 | + |
| 13 | + b: typeof x; |
| 14 | +>b : Symbol(b, Decl(cyclicTypeInstantiation.ts, 2, 13)) |
| 15 | +>x : Symbol(x, Decl(cyclicTypeInstantiation.ts, 1, 7)) |
| 16 | + |
| 17 | + }; |
| 18 | + return x; |
| 19 | +>x : Symbol(x, Decl(cyclicTypeInstantiation.ts, 1, 7)) |
| 20 | +} |
| 21 | + |
| 22 | +function bar<T>() { |
| 23 | +>bar : Symbol(bar, Decl(cyclicTypeInstantiation.ts, 6, 1)) |
| 24 | +>T : Symbol(T, Decl(cyclicTypeInstantiation.ts, 8, 13)) |
| 25 | + |
| 26 | + var x: { |
| 27 | +>x : Symbol(x, Decl(cyclicTypeInstantiation.ts, 9, 7)) |
| 28 | + |
| 29 | + a: T; |
| 30 | +>a : Symbol(a, Decl(cyclicTypeInstantiation.ts, 9, 12)) |
| 31 | +>T : Symbol(T, Decl(cyclicTypeInstantiation.ts, 8, 13)) |
| 32 | + |
| 33 | + b: typeof x; |
| 34 | +>b : Symbol(b, Decl(cyclicTypeInstantiation.ts, 10, 13)) |
| 35 | +>x : Symbol(x, Decl(cyclicTypeInstantiation.ts, 9, 7)) |
| 36 | + |
| 37 | + }; |
| 38 | + return x; |
| 39 | +>x : Symbol(x, Decl(cyclicTypeInstantiation.ts, 9, 7)) |
| 40 | +} |
| 41 | + |
| 42 | +var a = foo<string>(); |
| 43 | +>a : Symbol(a, Decl(cyclicTypeInstantiation.ts, 16, 3)) |
| 44 | +>foo : Symbol(foo, Decl(cyclicTypeInstantiation.ts, 0, 0)) |
| 45 | + |
| 46 | +var b = bar<string>(); |
| 47 | +>b : Symbol(b, Decl(cyclicTypeInstantiation.ts, 17, 3)) |
| 48 | +>bar : Symbol(bar, Decl(cyclicTypeInstantiation.ts, 6, 1)) |
| 49 | + |
| 50 | +// Relating types of a and b produces instantiations of the cyclic anonymous types in foo and bar |
| 51 | +a = b; |
| 52 | +>a : Symbol(a, Decl(cyclicTypeInstantiation.ts, 16, 3)) |
| 53 | +>b : Symbol(b, Decl(cyclicTypeInstantiation.ts, 17, 3)) |
| 54 | + |
0 commit comments