|
| 1 | +//// [tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass2.ts] //// |
| 2 | + |
| 3 | +=== protectedClassPropertyAccessibleWithinNestedSubclass2.ts === |
| 4 | +// https://github.com/microsoft/TypeScript/issues/59989 |
| 5 | + |
| 6 | +export class Foo { |
| 7 | +>Foo : Symbol(Foo, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 0, 0)) |
| 8 | + |
| 9 | + protected thisIsProtected = 1; |
| 10 | +>thisIsProtected : Symbol(Foo.thisIsProtected, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 2, 18)) |
| 11 | + |
| 12 | + private thisIsPrivate = 1; |
| 13 | +>thisIsPrivate : Symbol(Foo.thisIsPrivate, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 3, 32)) |
| 14 | + |
| 15 | + bar(): Foo { |
| 16 | +>bar : Symbol(Foo.bar, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 4, 28)) |
| 17 | +>Foo : Symbol(Foo, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 0, 0)) |
| 18 | + |
| 19 | + const that = this; |
| 20 | +>that : Symbol(that, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 7, 9)) |
| 21 | +>this : Symbol(Foo, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 0, 0)) |
| 22 | + |
| 23 | + return new (class extends Foo { |
| 24 | +>Foo : Symbol(Foo, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 0, 0)) |
| 25 | + |
| 26 | + something() { |
| 27 | +>something : Symbol((Anonymous class).something, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 9, 35)) |
| 28 | + |
| 29 | + return that.thisIsPrivate + that.thisIsProtected; // ok |
| 30 | +>that.thisIsPrivate : Symbol(Foo.thisIsPrivate, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 3, 32)) |
| 31 | +>that : Symbol(that, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 7, 9)) |
| 32 | +>thisIsPrivate : Symbol(Foo.thisIsPrivate, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 3, 32)) |
| 33 | +>that.thisIsProtected : Symbol(Foo.thisIsProtected, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 2, 18)) |
| 34 | +>that : Symbol(that, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 7, 9)) |
| 35 | +>thisIsProtected : Symbol(Foo.thisIsProtected, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 2, 18)) |
| 36 | + } |
| 37 | + })(); |
| 38 | + } |
| 39 | +} |
| 40 | + |
| 41 | +export class Foo2 { |
| 42 | +>Foo2 : Symbol(Foo2, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 15, 1)) |
| 43 | + |
| 44 | + protected thisIsProtected = 1; |
| 45 | +>thisIsProtected : Symbol(Foo2.thisIsProtected, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 17, 19)) |
| 46 | + |
| 47 | + private thisIsPrivate = 1; |
| 48 | +>thisIsPrivate : Symbol(Foo2.thisIsPrivate, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 18, 32)) |
| 49 | + |
| 50 | + bar() { |
| 51 | +>bar : Symbol(Foo2.bar, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 19, 28)) |
| 52 | + |
| 53 | + const that = this; |
| 54 | +>that : Symbol(that, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 22, 9)) |
| 55 | +>this : Symbol(Foo2, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 15, 1)) |
| 56 | + |
| 57 | + return new (class { |
| 58 | + something() { |
| 59 | +>something : Symbol((Anonymous class).something, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 24, 23)) |
| 60 | + |
| 61 | + return that.thisIsPrivate + that.thisIsProtected; // ok |
| 62 | +>that.thisIsPrivate : Symbol(Foo2.thisIsPrivate, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 18, 32)) |
| 63 | +>that : Symbol(that, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 22, 9)) |
| 64 | +>thisIsPrivate : Symbol(Foo2.thisIsPrivate, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 18, 32)) |
| 65 | +>that.thisIsProtected : Symbol(Foo2.thisIsProtected, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 17, 19)) |
| 66 | +>that : Symbol(that, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 22, 9)) |
| 67 | +>thisIsProtected : Symbol(Foo2.thisIsProtected, Decl(protectedClassPropertyAccessibleWithinNestedSubclass2.ts, 17, 19)) |
| 68 | + } |
| 69 | + })(); |
| 70 | + } |
| 71 | +} |
| 72 | + |
0 commit comments