|
| 1 | +//// [tests/cases/compiler/classStaticPropertyNoSpuriousCircularityError1.ts] //// |
| 2 | + |
| 3 | +=== classStaticPropertyNoSpuriousCircularityError1.ts === |
| 4 | +// https://github.com/microsoft/TypeScript/issues/59271 |
| 5 | +// https://github.com/microsoft/TypeScript/issues/62552 |
| 6 | + |
| 7 | +function id<T>(x: T): T { |
| 8 | +>id : Symbol(id, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 0, 0)) |
| 9 | +>T : Symbol(T, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 3, 12)) |
| 10 | +>x : Symbol(x, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 3, 15)) |
| 11 | +>T : Symbol(T, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 3, 12)) |
| 12 | +>T : Symbol(T, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 3, 12)) |
| 13 | + |
| 14 | + return x |
| 15 | +>x : Symbol(x, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 3, 15)) |
| 16 | +} |
| 17 | + |
| 18 | +const Foo = id(class { |
| 19 | +>Foo : Symbol(Foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 7, 5)) |
| 20 | +>id : Symbol(id, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 0, 0)) |
| 21 | + |
| 22 | + static readonly foo = id(42) // ok |
| 23 | +>foo : Symbol((Anonymous class).foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 7, 22)) |
| 24 | +>id : Symbol(id, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 0, 0)) |
| 25 | + |
| 26 | +}) |
| 27 | + |
| 28 | +Foo.foo // 42 |
| 29 | +>Foo.foo : Symbol((Anonymous class).foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 7, 22)) |
| 30 | +>Foo : Symbol(Foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 7, 5)) |
| 31 | +>foo : Symbol((Anonymous class).foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 7, 22)) |
| 32 | + |
| 33 | +const Foo2 = id(class { |
| 34 | +>Foo2 : Symbol(Foo2, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 13, 5)) |
| 35 | +>id : Symbol(id, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 0, 0)) |
| 36 | + |
| 37 | + static foo = id(42) // ok |
| 38 | +>foo : Symbol((Anonymous class).foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 13, 23)) |
| 39 | +>id : Symbol(id, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 0, 0)) |
| 40 | + |
| 41 | +}) |
| 42 | + |
| 43 | +Foo2.foo // number |
| 44 | +>Foo2.foo : Symbol((Anonymous class).foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 13, 23)) |
| 45 | +>Foo2 : Symbol(Foo2, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 13, 5)) |
| 46 | +>foo : Symbol((Anonymous class).foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 13, 23)) |
| 47 | + |
| 48 | +const Foo3 = id(class { |
| 49 | +>Foo3 : Symbol(Foo3, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 19, 5)) |
| 50 | +>id : Symbol(id, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 0, 0)) |
| 51 | + |
| 52 | + static readonly foo = [42]; |
| 53 | +>foo : Symbol((Anonymous class).foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 19, 23)) |
| 54 | + |
| 55 | +}); |
| 56 | + |
| 57 | +const Foo4 = id( |
| 58 | +>Foo4 : Symbol(Foo4, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 23, 5)) |
| 59 | +>id : Symbol(id, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 0, 0)) |
| 60 | + |
| 61 | + class A { |
| 62 | +>A : Symbol(A, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 23, 16)) |
| 63 | + |
| 64 | + static foo = {}; |
| 65 | +>foo : Symbol(A.foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 24, 11)) |
| 66 | + |
| 67 | + }, |
| 68 | +); |
| 69 | + |
| 70 | +Foo4.foo // {} |
| 71 | +>Foo4.foo : Symbol(A.foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 24, 11)) |
| 72 | +>Foo4 : Symbol(Foo4, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 23, 5)) |
| 73 | +>foo : Symbol(A.foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 24, 11)) |
| 74 | + |
| 75 | +class Circular { |
| 76 | +>Circular : Symbol(Circular, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 29, 8)) |
| 77 | + |
| 78 | + static foo = Circular.foo; // error |
| 79 | +>foo : Symbol(Circular.foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 31, 16)) |
| 80 | +>Circular.foo : Symbol(Circular.foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 31, 16)) |
| 81 | +>Circular : Symbol(Circular, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 29, 8)) |
| 82 | +>foo : Symbol(Circular.foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 31, 16)) |
| 83 | +} |
| 84 | + |
| 85 | +const Circular2 = id(class C { |
| 86 | +>Circular2 : Symbol(Circular2, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 35, 5)) |
| 87 | +>id : Symbol(id, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 0, 0)) |
| 88 | +>C : Symbol(C, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 35, 21)) |
| 89 | + |
| 90 | + static foo = C.foo; // error |
| 91 | +>foo : Symbol(C.foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 35, 30)) |
| 92 | +>C.foo : Symbol(C.foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 35, 30)) |
| 93 | +>C : Symbol(C, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 35, 21)) |
| 94 | +>foo : Symbol(C.foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 35, 30)) |
| 95 | + |
| 96 | +}); |
| 97 | + |
| 98 | +const Circular3 = id(class { |
| 99 | +>Circular3 : Symbol(Circular3, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 39, 5)) |
| 100 | +>id : Symbol(id, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 0, 0)) |
| 101 | + |
| 102 | + static foo = Circular3.foo; // error |
| 103 | +>foo : Symbol((Anonymous class).foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 39, 28)) |
| 104 | +>Circular3.foo : Symbol((Anonymous class).foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 39, 28)) |
| 105 | +>Circular3 : Symbol(Circular3, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 39, 5)) |
| 106 | +>foo : Symbol((Anonymous class).foo, Decl(classStaticPropertyNoSpuriousCircularityError1.ts, 39, 28)) |
| 107 | + |
| 108 | +}); |
| 109 | + |
0 commit comments