Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e1be0ff

Browse filesBrowse files
committed
Added more tests and accept baselines
1 parent 276885c commit e1be0ff
Copy full SHA for e1be0ff

3 files changed

+554Lines changed: 554 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file
+180Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(15,17): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
2+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(32,17): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'.
3+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(34,17): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'.
4+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(35,17): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
5+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(36,17): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'.
6+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(52,17): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'.
7+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(53,17): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'.
8+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(55,17): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
9+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(73,17): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'.
10+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(74,17): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'.
11+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(75,17): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'.
12+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(77,17): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'.
13+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(93,17): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'.
14+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(94,17): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'.
15+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(95,17): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'.
16+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(96,17): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
17+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(110,1): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
18+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(111,1): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
19+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(112,1): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
20+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(113,1): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
21+
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts(114,1): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
22+
23+
24+
==== tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinNestedSubclass1.ts (21 errors) ====
25+
class Base {
26+
protected x: string;
27+
method() {
28+
class A {
29+
methoda() {
30+
var b: Base;
31+
var d1: Derived1;
32+
var d2: Derived2;
33+
var d3: Derived3;
34+
var d4: Derived4;
35+
36+
b.x; // OK, accessed within their declaring class
37+
d1.x; // OK, accessed within their declaring class
38+
d2.x; // OK, accessed within their declaring class
39+
d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses
40+
~~~~
41+
!!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
42+
d4.x; // OK, accessed within their declaring class
43+
}
44+
}
45+
}
46+
}
47+
48+
class Derived1 extends Base {
49+
method1() {
50+
class B {
51+
method1b() {
52+
var b: Base;
53+
var d1: Derived1;
54+
var d2: Derived2;
55+
var d3: Derived3;
56+
var d4: Derived4;
57+
58+
b.x; // Error, isn't accessed through an instance of the enclosing class
59+
~~~
60+
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'.
61+
d1.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class
62+
d2.x; // Error, isn't accessed through an instance of the enclosing class
63+
~~~~
64+
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'.
65+
d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses
66+
~~~~
67+
!!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
68+
d4.x; // Error, isn't accessed through an instance of the enclosing class
69+
~~~~
70+
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'.
71+
}
72+
}
73+
}
74+
}
75+
76+
class Derived2 extends Base {
77+
method2() {
78+
class C {
79+
method2c() {
80+
var b: Base;
81+
var d1: Derived1;
82+
var d2: Derived2;
83+
var d3: Derived3;
84+
var d4: Derived4;
85+
86+
b.x; // Error, isn't accessed through an instance of the enclosing class
87+
~~~
88+
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'.
89+
d1.x; // Error, isn't accessed through an instance of the enclosing class
90+
~~~~
91+
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'.
92+
d2.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class
93+
d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses
94+
~~~~
95+
!!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
96+
d4.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class or one of its subclasses
97+
}
98+
}
99+
}
100+
}
101+
102+
class Derived3 extends Derived1 {
103+
protected x: string;
104+
method3() {
105+
class D {
106+
method3d() {
107+
var b: Base;
108+
var d1: Derived1;
109+
var d2: Derived2;
110+
var d3: Derived3;
111+
var d4: Derived4;
112+
113+
b.x; // Error, isn't accessed through an instance of the enclosing class
114+
~~~
115+
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'.
116+
d1.x; // Error, isn't accessed through an instance of the enclosing class
117+
~~~~
118+
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'.
119+
d2.x; // Error, isn't accessed through an instance of the enclosing class
120+
~~~~
121+
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'.
122+
d3.x; // OK, accessed within their declaring class
123+
d4.x; // Error, isn't accessed through an instance of the enclosing class
124+
~~~~
125+
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'.
126+
}
127+
}
128+
}
129+
}
130+
131+
class Derived4 extends Derived2 {
132+
method4() {
133+
class E {
134+
method4e() {
135+
var b: Base;
136+
var d1: Derived1;
137+
var d2: Derived2;
138+
var d3: Derived3;
139+
var d4: Derived4;
140+
141+
b.x; // Error, isn't accessed through an instance of the enclosing class
142+
~~~
143+
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'.
144+
d1.x; // Error, isn't accessed through an instance of the enclosing class
145+
~~~~
146+
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'.
147+
d2.x; // Error, isn't accessed through an instance of the enclosing class
148+
~~~~
149+
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'.
150+
d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses
151+
~~~~
152+
!!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
153+
d4.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class
154+
}
155+
}
156+
}
157+
}
158+
159+
160+
var b: Base;
161+
var d1: Derived1;
162+
var d2: Derived2;
163+
var d3: Derived3;
164+
var d4: Derived4;
165+
166+
b.x; // Error, neither within their declaring class nor classes derived from their declaring class
167+
~~~
168+
!!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
169+
d1.x; // Error, neither within their declaring class nor classes derived from their declaring class
170+
~~~~
171+
!!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
172+
d2.x; // Error, neither within their declaring class nor classes derived from their declaring class
173+
~~~~
174+
!!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
175+
d3.x; // Error, neither within their declaring class nor classes derived from their declaring class
176+
~~~~
177+
!!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
178+
d4.x; // Error, neither within their declaring class nor classes derived from their declaring class
179+
~~~~
180+
!!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.