From 9a384641874b9bd5ea2c43c6eddf0c36f8432073 Mon Sep 17 00:00:00 2001 From: AbubakerB Date: Wed, 17 Feb 2016 22:47:14 +0000 Subject: [PATCH] Accept baselines --- ...lassPropertyAccessibleWithinNestedClass.js | 84 ++++++++++ ...ropertyAccessibleWithinNestedClass.symbols | 154 +++++++++++++++++ ...sPropertyAccessibleWithinNestedClass.types | 158 ++++++++++++++++++ ...lassPropertyAccessibleWithinNestedClass.js | 84 ++++++++++ ...ropertyAccessibleWithinNestedClass.symbols | 154 +++++++++++++++++ ...sPropertyAccessibleWithinNestedClass.types | 158 ++++++++++++++++++ ...yAccessibleWithinNestedSubclass.errors.txt | 44 +++++ ...sPropertyAccessibleWithinNestedSubclass.js | 99 +++++++++++ 8 files changed, 935 insertions(+) create mode 100644 tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.js create mode 100644 tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.symbols create mode 100644 tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.types create mode 100644 tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.js create mode 100644 tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.symbols create mode 100644 tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.types create mode 100644 tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.errors.txt create mode 100644 tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js diff --git a/tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.js b/tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.js new file mode 100644 index 00000000000..3bb0a7da3ea --- /dev/null +++ b/tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.js @@ -0,0 +1,84 @@ +//// [privateClassPropertyAccessibleWithinNestedClass.ts] +// no errors + +class C { + private x: string; + private get y() { return this.x; } + private set y(x) { this.y = this.x; } + private foo() { return this.foo; } + + private static x: string; + private static get y() { return this.x; } + private static set y(x) { this.y = this.x; } + private static foo() { return this.foo; } + private static bar() { this.foo(); } + + private bar() { + class C2 { + private foo() { + let x: C; + var x1 = x.foo; + var x2 = x.bar; + var x3 = x.x; + var x4 = x.y; + + var sx1 = C.x; + var sx2 = C.y; + var sx3 = C.bar; + var sx4 = C.foo; + + let y = new C(); + var y1 = y.foo; + var y2 = y.bar; + var y3 = y.x; + var y4 = y.y; + } + } + } +} + +//// [privateClassPropertyAccessibleWithinNestedClass.js] +// no errors +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "y", { + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, + enumerable: true, + configurable: true + }); + C.prototype.foo = function () { return this.foo; }; + Object.defineProperty(C, "y", { + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, + enumerable: true, + configurable: true + }); + C.foo = function () { return this.foo; }; + C.bar = function () { this.foo(); }; + C.prototype.bar = function () { + var C2 = (function () { + function C2() { + } + C2.prototype.foo = function () { + var x; + var x1 = x.foo; + var x2 = x.bar; + var x3 = x.x; + var x4 = x.y; + var sx1 = C.x; + var sx2 = C.y; + var sx3 = C.bar; + var sx4 = C.foo; + var y = new C(); + var y1 = y.foo; + var y2 = y.bar; + var y3 = y.x; + var y4 = y.y; + }; + return C2; + }()); + }; + return C; +}()); diff --git a/tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.symbols b/tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.symbols new file mode 100644 index 00000000000..dd22887eb23 --- /dev/null +++ b/tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.symbols @@ -0,0 +1,154 @@ +=== tests/cases/conformance/classes/members/accessibility/privateClassPropertyAccessibleWithinNestedClass.ts === +// no errors + +class C { +>C : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) + + private x: string; +>x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) + + private get y() { return this.x; } +>y : Symbol(y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 3, 22), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 4, 38)) +>this.x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) +>this : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) + + private set y(x) { this.y = this.x; } +>y : Symbol(y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 3, 22), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 4, 38)) +>x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 5, 18)) +>this.y : Symbol(y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 3, 22), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 4, 38)) +>this : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>y : Symbol(y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 3, 22), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 4, 38)) +>this.x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) +>this : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) + + private foo() { return this.foo; } +>foo : Symbol(foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 5, 41)) +>this.foo : Symbol(foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 5, 41)) +>this : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>foo : Symbol(foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 5, 41)) + + private static x: string; +>x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 6, 38)) + + private static get y() { return this.x; } +>y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 8, 29), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 9, 45)) +>this.x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 6, 38)) +>this : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 6, 38)) + + private static set y(x) { this.y = this.x; } +>y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 8, 29), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 9, 45)) +>x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 10, 25)) +>this.y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 8, 29), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 9, 45)) +>this : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 8, 29), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 9, 45)) +>this.x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 6, 38)) +>this : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 6, 38)) + + private static foo() { return this.foo; } +>foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 10, 48)) +>this.foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 10, 48)) +>this : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 10, 48)) + + private static bar() { this.foo(); } +>bar : Symbol(C.bar, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 11, 45)) +>this.foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 10, 48)) +>this : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 10, 48)) + + private bar() { +>bar : Symbol(bar, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 12, 40)) + + class C2 { +>C2 : Symbol(C2, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 14, 19)) + + private foo() { +>foo : Symbol(foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 15, 18)) + + let x: C; +>x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 17, 19)) +>C : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) + + var x1 = x.foo; +>x1 : Symbol(x1, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 18, 19)) +>x.foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 5, 41)) +>x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 17, 19)) +>foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 5, 41)) + + var x2 = x.bar; +>x2 : Symbol(x2, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 19, 19)) +>x.bar : Symbol(C.bar, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 12, 40)) +>x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 17, 19)) +>bar : Symbol(C.bar, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 12, 40)) + + var x3 = x.x; +>x3 : Symbol(x3, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 20, 19)) +>x.x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) +>x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 17, 19)) +>x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) + + var x4 = x.y; +>x4 : Symbol(x4, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 21, 19)) +>x.y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 3, 22), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 4, 38)) +>x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 17, 19)) +>y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 3, 22), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 4, 38)) + + var sx1 = C.x; +>sx1 : Symbol(sx1, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 23, 19)) +>C.x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 6, 38)) +>C : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>x : Symbol(C.x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 6, 38)) + + var sx2 = C.y; +>sx2 : Symbol(sx2, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 24, 19)) +>C.y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 8, 29), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 9, 45)) +>C : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 8, 29), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 9, 45)) + + var sx3 = C.bar; +>sx3 : Symbol(sx3, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 25, 19)) +>C.bar : Symbol(C.bar, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 11, 45)) +>C : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>bar : Symbol(C.bar, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 11, 45)) + + var sx4 = C.foo; +>sx4 : Symbol(sx4, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 26, 19)) +>C.foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 10, 48)) +>C : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 10, 48)) + + let y = new C(); +>y : Symbol(y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 28, 19)) +>C : Symbol(C, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) + + var y1 = y.foo; +>y1 : Symbol(y1, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 29, 19)) +>y.foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 5, 41)) +>y : Symbol(y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 28, 19)) +>foo : Symbol(C.foo, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 5, 41)) + + var y2 = y.bar; +>y2 : Symbol(y2, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 30, 19)) +>y.bar : Symbol(C.bar, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 12, 40)) +>y : Symbol(y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 28, 19)) +>bar : Symbol(C.bar, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 12, 40)) + + var y3 = y.x; +>y3 : Symbol(y3, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 31, 19)) +>y.x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) +>y : Symbol(y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 28, 19)) +>x : Symbol(x, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) + + var y4 = y.y; +>y4 : Symbol(y4, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 32, 19)) +>y.y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 3, 22), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 4, 38)) +>y : Symbol(y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 28, 19)) +>y : Symbol(C.y, Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 3, 22), Decl(privateClassPropertyAccessibleWithinNestedClass.ts, 4, 38)) + } + } + } +} diff --git a/tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.types b/tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.types new file mode 100644 index 00000000000..ee8eb82b940 --- /dev/null +++ b/tests/baselines/reference/privateClassPropertyAccessibleWithinNestedClass.types @@ -0,0 +1,158 @@ +=== tests/cases/conformance/classes/members/accessibility/privateClassPropertyAccessibleWithinNestedClass.ts === +// no errors + +class C { +>C : C + + private x: string; +>x : string + + private get y() { return this.x; } +>y : string +>this.x : string +>this : this +>x : string + + private set y(x) { this.y = this.x; } +>y : string +>x : string +>this.y = this.x : string +>this.y : string +>this : this +>y : string +>this.x : string +>this : this +>x : string + + private foo() { return this.foo; } +>foo : () => any +>this.foo : () => any +>this : this +>foo : () => any + + private static x: string; +>x : string + + private static get y() { return this.x; } +>y : string +>this.x : string +>this : typeof C +>x : string + + private static set y(x) { this.y = this.x; } +>y : string +>x : string +>this.y = this.x : string +>this.y : string +>this : typeof C +>y : string +>this.x : string +>this : typeof C +>x : string + + private static foo() { return this.foo; } +>foo : () => typeof C.foo +>this.foo : () => typeof C.foo +>this : typeof C +>foo : () => typeof C.foo + + private static bar() { this.foo(); } +>bar : () => void +>this.foo() : () => typeof C.foo +>this.foo : () => typeof C.foo +>this : typeof C +>foo : () => typeof C.foo + + private bar() { +>bar : () => void + + class C2 { +>C2 : C2 + + private foo() { +>foo : () => void + + let x: C; +>x : C +>C : C + + var x1 = x.foo; +>x1 : () => any +>x.foo : () => any +>x : C +>foo : () => any + + var x2 = x.bar; +>x2 : () => void +>x.bar : () => void +>x : C +>bar : () => void + + var x3 = x.x; +>x3 : string +>x.x : string +>x : C +>x : string + + var x4 = x.y; +>x4 : string +>x.y : string +>x : C +>y : string + + var sx1 = C.x; +>sx1 : string +>C.x : string +>C : typeof C +>x : string + + var sx2 = C.y; +>sx2 : string +>C.y : string +>C : typeof C +>y : string + + var sx3 = C.bar; +>sx3 : () => void +>C.bar : () => void +>C : typeof C +>bar : () => void + + var sx4 = C.foo; +>sx4 : () => typeof C.foo +>C.foo : () => typeof C.foo +>C : typeof C +>foo : () => typeof C.foo + + let y = new C(); +>y : C +>new C() : C +>C : typeof C + + var y1 = y.foo; +>y1 : () => any +>y.foo : () => any +>y : C +>foo : () => any + + var y2 = y.bar; +>y2 : () => void +>y.bar : () => void +>y : C +>bar : () => void + + var y3 = y.x; +>y3 : string +>y.x : string +>y : C +>x : string + + var y4 = y.y; +>y4 : string +>y.y : string +>y : C +>y : string + } + } + } +} diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.js new file mode 100644 index 00000000000..2bc544e046e --- /dev/null +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.js @@ -0,0 +1,84 @@ +//// [protectedClassPropertyAccessibleWithinNestedClass.ts] +// no errors + +class C { + protected x: string; + protected get y() { return this.x; } + protected set y(x) { this.y = this.x; } + protected foo() { return this.foo; } + + protected static x: string; + protected static get y() { return this.x; } + protected static set y(x) { this.y = this.x; } + protected static foo() { return this.foo; } + protected static bar() { this.foo(); } + + protected bar() { + class C2 { + protected foo() { + let x: C; + var x1 = x.foo; + var x2 = x.bar; + var x3 = x.x; + var x4 = x.y; + + var sx1 = C.x; + var sx2 = C.y; + var sx3 = C.bar; + var sx4 = C.foo; + + let y = new C(); + var y1 = y.foo; + var y2 = y.bar; + var y3 = y.x; + var y4 = y.y; + } + } + } +} + +//// [protectedClassPropertyAccessibleWithinNestedClass.js] +// no errors +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "y", { + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, + enumerable: true, + configurable: true + }); + C.prototype.foo = function () { return this.foo; }; + Object.defineProperty(C, "y", { + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, + enumerable: true, + configurable: true + }); + C.foo = function () { return this.foo; }; + C.bar = function () { this.foo(); }; + C.prototype.bar = function () { + var C2 = (function () { + function C2() { + } + C2.prototype.foo = function () { + var x; + var x1 = x.foo; + var x2 = x.bar; + var x3 = x.x; + var x4 = x.y; + var sx1 = C.x; + var sx2 = C.y; + var sx3 = C.bar; + var sx4 = C.foo; + var y = new C(); + var y1 = y.foo; + var y2 = y.bar; + var y3 = y.x; + var y4 = y.y; + }; + return C2; + }()); + }; + return C; +}()); diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.symbols b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.symbols new file mode 100644 index 00000000000..ca10d9652e4 --- /dev/null +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.symbols @@ -0,0 +1,154 @@ +=== tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedClass.ts === +// no errors + +class C { +>C : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) + + protected x: string; +>x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) + + protected get y() { return this.x; } +>y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 4, 40)) +>this.x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) +>this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) + + protected set y(x) { this.y = this.x; } +>y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 4, 40)) +>x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 5, 20)) +>this.y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 4, 40)) +>this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 4, 40)) +>this.x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) +>this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) + + protected foo() { return this.foo; } +>foo : Symbol(foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 5, 43)) +>this.foo : Symbol(foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 5, 43)) +>this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>foo : Symbol(foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 5, 43)) + + protected static x: string; +>x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 6, 40)) + + protected static get y() { return this.x; } +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 8, 31), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 9, 47)) +>this.x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 6, 40)) +>this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 6, 40)) + + protected static set y(x) { this.y = this.x; } +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 8, 31), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 9, 47)) +>x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 10, 27)) +>this.y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 8, 31), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 9, 47)) +>this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 8, 31), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 9, 47)) +>this.x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 6, 40)) +>this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 6, 40)) + + protected static foo() { return this.foo; } +>foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 10, 50)) +>this.foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 10, 50)) +>this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 10, 50)) + + protected static bar() { this.foo(); } +>bar : Symbol(C.bar, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 11, 47)) +>this.foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 10, 50)) +>this : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 10, 50)) + + protected bar() { +>bar : Symbol(bar, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 12, 42)) + + class C2 { +>C2 : Symbol(C2, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 14, 21)) + + protected foo() { +>foo : Symbol(foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 15, 18)) + + let x: C; +>x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 17, 19)) +>C : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) + + var x1 = x.foo; +>x1 : Symbol(x1, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 18, 19)) +>x.foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 5, 43)) +>x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 17, 19)) +>foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 5, 43)) + + var x2 = x.bar; +>x2 : Symbol(x2, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 19, 19)) +>x.bar : Symbol(C.bar, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 12, 42)) +>x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 17, 19)) +>bar : Symbol(C.bar, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 12, 42)) + + var x3 = x.x; +>x3 : Symbol(x3, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 20, 19)) +>x.x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) +>x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 17, 19)) +>x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) + + var x4 = x.y; +>x4 : Symbol(x4, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 21, 19)) +>x.y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 4, 40)) +>x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 17, 19)) +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 4, 40)) + + var sx1 = C.x; +>sx1 : Symbol(sx1, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 23, 19)) +>C.x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 6, 40)) +>C : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>x : Symbol(C.x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 6, 40)) + + var sx2 = C.y; +>sx2 : Symbol(sx2, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 24, 19)) +>C.y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 8, 31), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 9, 47)) +>C : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 8, 31), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 9, 47)) + + var sx3 = C.bar; +>sx3 : Symbol(sx3, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 25, 19)) +>C.bar : Symbol(C.bar, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 11, 47)) +>C : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>bar : Symbol(C.bar, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 11, 47)) + + var sx4 = C.foo; +>sx4 : Symbol(sx4, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 26, 19)) +>C.foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 10, 50)) +>C : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) +>foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 10, 50)) + + let y = new C(); +>y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 28, 19)) +>C : Symbol(C, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 0, 0)) + + var y1 = y.foo; +>y1 : Symbol(y1, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 29, 19)) +>y.foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 5, 43)) +>y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 28, 19)) +>foo : Symbol(C.foo, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 5, 43)) + + var y2 = y.bar; +>y2 : Symbol(y2, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 30, 19)) +>y.bar : Symbol(C.bar, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 12, 42)) +>y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 28, 19)) +>bar : Symbol(C.bar, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 12, 42)) + + var y3 = y.x; +>y3 : Symbol(y3, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 31, 19)) +>y.x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) +>y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 28, 19)) +>x : Symbol(x, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 2, 9)) + + var y4 = y.y; +>y4 : Symbol(y4, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 32, 19)) +>y.y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 4, 40)) +>y : Symbol(y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 28, 19)) +>y : Symbol(C.y, Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 3, 24), Decl(protectedClassPropertyAccessibleWithinNestedClass.ts, 4, 40)) + } + } + } +} diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.types b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.types new file mode 100644 index 00000000000..f7cff2e6719 --- /dev/null +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedClass.types @@ -0,0 +1,158 @@ +=== tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedClass.ts === +// no errors + +class C { +>C : C + + protected x: string; +>x : string + + protected get y() { return this.x; } +>y : string +>this.x : string +>this : this +>x : string + + protected set y(x) { this.y = this.x; } +>y : string +>x : string +>this.y = this.x : string +>this.y : string +>this : this +>y : string +>this.x : string +>this : this +>x : string + + protected foo() { return this.foo; } +>foo : () => any +>this.foo : () => any +>this : this +>foo : () => any + + protected static x: string; +>x : string + + protected static get y() { return this.x; } +>y : string +>this.x : string +>this : typeof C +>x : string + + protected static set y(x) { this.y = this.x; } +>y : string +>x : string +>this.y = this.x : string +>this.y : string +>this : typeof C +>y : string +>this.x : string +>this : typeof C +>x : string + + protected static foo() { return this.foo; } +>foo : () => typeof C.foo +>this.foo : () => typeof C.foo +>this : typeof C +>foo : () => typeof C.foo + + protected static bar() { this.foo(); } +>bar : () => void +>this.foo() : () => typeof C.foo +>this.foo : () => typeof C.foo +>this : typeof C +>foo : () => typeof C.foo + + protected bar() { +>bar : () => void + + class C2 { +>C2 : C2 + + protected foo() { +>foo : () => void + + let x: C; +>x : C +>C : C + + var x1 = x.foo; +>x1 : () => any +>x.foo : () => any +>x : C +>foo : () => any + + var x2 = x.bar; +>x2 : () => void +>x.bar : () => void +>x : C +>bar : () => void + + var x3 = x.x; +>x3 : string +>x.x : string +>x : C +>x : string + + var x4 = x.y; +>x4 : string +>x.y : string +>x : C +>y : string + + var sx1 = C.x; +>sx1 : string +>C.x : string +>C : typeof C +>x : string + + var sx2 = C.y; +>sx2 : string +>C.y : string +>C : typeof C +>y : string + + var sx3 = C.bar; +>sx3 : () => void +>C.bar : () => void +>C : typeof C +>bar : () => void + + var sx4 = C.foo; +>sx4 : () => typeof C.foo +>C.foo : () => typeof C.foo +>C : typeof C +>foo : () => typeof C.foo + + let y = new C(); +>y : C +>new C() : C +>C : typeof C + + var y1 = y.foo; +>y1 : () => any +>y.foo : () => any +>y : C +>foo : () => any + + var y2 = y.bar; +>y2 : () => void +>y.bar : () => void +>y : C +>bar : () => void + + var y3 = y.x; +>y3 : string +>y.x : string +>y : C +>x : string + + var y4 = y.y; +>y4 : string +>y.y : string +>y : C +>y : string + } + } + } +} diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.errors.txt b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.errors.txt new file mode 100644 index 00000000000..0bf38477f70 --- /dev/null +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.errors.txt @@ -0,0 +1,44 @@ +tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass.ts(25,28): error TS2339: Property 'z' does not exist on type 'C'. + + +==== tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass.ts (1 errors) ==== + + class B { + protected x: string; + protected static x: string; + } + + class C extends B { + protected get y() { return this.x; } + protected set y(x) { this.y = this.x; } + protected foo() { return this.x; } + + protected static get y() { return this.x; } + protected static set y(x) { this.y = this.x; } + protected static foo() { return this.x; } + protected static bar() { this.foo(); } + + protected bar() { + class D { + protected foo() { + var c = new C(); + var c1 = c.y; + var c2 = c.x; + var c3 = c.foo; + var c4 = c.bar; + var c5 = c.z; // error + ~ +!!! error TS2339: Property 'z' does not exist on type 'C'. + + var sc1 = C.x; + var sc2 = C.y; + var sc3 = C.foo; + var sc4 = C.bar; + } + } + } + } + + class E extends C { + protected z: string; + } \ No newline at end of file diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js new file mode 100644 index 00000000000..255c05ac3ac --- /dev/null +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js @@ -0,0 +1,99 @@ +//// [protectedClassPropertyAccessibleWithinNestedSubclass.ts] + +class B { + protected x: string; + protected static x: string; +} + +class C extends B { + protected get y() { return this.x; } + protected set y(x) { this.y = this.x; } + protected foo() { return this.x; } + + protected static get y() { return this.x; } + protected static set y(x) { this.y = this.x; } + protected static foo() { return this.x; } + protected static bar() { this.foo(); } + + protected bar() { + class D { + protected foo() { + var c = new C(); + var c1 = c.y; + var c2 = c.x; + var c3 = c.foo; + var c4 = c.bar; + var c5 = c.z; // error + + var sc1 = C.x; + var sc2 = C.y; + var sc3 = C.foo; + var sc4 = C.bar; + } + } + } +} + +class E extends C { + protected z: string; +} + +//// [protectedClassPropertyAccessibleWithinNestedSubclass.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var B = (function () { + function B() { + } + return B; +}()); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + Object.defineProperty(C.prototype, "y", { + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, + enumerable: true, + configurable: true + }); + C.prototype.foo = function () { return this.x; }; + Object.defineProperty(C, "y", { + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, + enumerable: true, + configurable: true + }); + C.foo = function () { return this.x; }; + C.bar = function () { this.foo(); }; + C.prototype.bar = function () { + var D = (function () { + function D() { + } + D.prototype.foo = function () { + var c = new C(); + var c1 = c.y; + var c2 = c.x; + var c3 = c.foo; + var c4 = c.bar; + var c5 = c.z; // error + var sc1 = C.x; + var sc2 = C.y; + var sc3 = C.foo; + var sc4 = C.bar; + }; + return D; + }()); + }; + return C; +}(B)); +var E = (function (_super) { + __extends(E, _super); + function E() { + _super.apply(this, arguments); + } + return E; +}(C));