File: protectedClassPropertyAccessibleWithinSubclass2.errors.txt

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (160 lines) | stat: -rw-r--r-- 12,803 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(13,12): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(26,11): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. This is an instance of class 'Base'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(28,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. This is an instance of class 'Derived2'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(29,12): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(30,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. This is an instance of class 'Derived4'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(42,11): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'. This is an instance of class 'Base'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(43,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'. This is an instance of class 'Derived1'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(45,12): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(59,11): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. This is an instance of class 'Base'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(60,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. This is an instance of class 'Derived1'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(61,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. This is an instance of class 'Derived2'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(63,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. This is an instance of class 'Derived4'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(75,11): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. This is an instance of class 'Base'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(76,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. This is an instance of class 'Derived1'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(77,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. This is an instance of class 'Derived2'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(78,12): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(90,3): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(91,4): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(92,4): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(93,4): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(94,4): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.


==== tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts (21 errors) ====
    class Base {
        protected x: string;
        method() {
            var b: Base;
            var d1: Derived1;
            var d2: Derived2;
            var d3: Derived3;
            var d4: Derived4;
    
            b.x;            // OK, accessed within their declaring class
            d1.x;           // OK, accessed within their declaring class
            d2.x;           // OK, accessed within their declaring class
            d3.x;           // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses
               ~
!!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
            d4.x;           // OK, accessed within their declaring class
        }
    }
    
    class Derived1 extends Base {
        method1() {
            var b: Base;
            var d1: Derived1;
            var d2: Derived2;
            var d3: Derived3;
            var d4: Derived4;
    
            b.x;            // Error, isn't accessed through an instance of the enclosing class
              ~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. This is an instance of class 'Base'.
            d1.x;           // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class
            d2.x;           // Error, isn't accessed through an instance of the enclosing class
               ~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. This is an instance of class 'Derived2'.
            d3.x;           // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses
               ~
!!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
            d4.x;           // Error, isn't accessed through an instance of the enclosing class
               ~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. This is an instance of class 'Derived4'.
        }
    }
    
    class Derived2 extends Base {
        method2() {
            var b: Base;
            var d1: Derived1;
            var d2: Derived2;
            var d3: Derived3;
            var d4: Derived4;
    
            b.x;            // Error, isn't accessed through an instance of the enclosing class
              ~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'. This is an instance of class 'Base'.
            d1.x;           // Error, isn't accessed through an instance of the enclosing class
               ~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'. This is an instance of class 'Derived1'.
            d2.x;           // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class
            d3.x;           // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses
               ~
!!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
            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
        }
    }
    
    class Derived3 extends Derived1 {
        protected x: string;
        method3() {
            var b: Base;
            var d1: Derived1;
            var d2: Derived2;
            var d3: Derived3;
            var d4: Derived4;
    
            b.x;            // Error, isn't accessed through an instance of the enclosing class
              ~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. This is an instance of class 'Base'.
            d1.x;           // Error, isn't accessed through an instance of the enclosing class
               ~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. This is an instance of class 'Derived1'.
            d2.x;           // Error, isn't accessed through an instance of the enclosing class
               ~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. This is an instance of class 'Derived2'.
            d3.x;           // OK, accessed within their declaring class
            d4.x;           // Error, isn't accessed through an instance of the enclosing class
               ~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. This is an instance of class 'Derived4'.
        }
    }
    
    class Derived4 extends Derived2 {
        method4() {
            var b: Base;
            var d1: Derived1;
            var d2: Derived2;
            var d3: Derived3;
            var d4: Derived4;
    
            b.x;            // Error, isn't accessed through an instance of the enclosing class
              ~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. This is an instance of class 'Base'.
            d1.x;           // Error, isn't accessed through an instance of the enclosing class
               ~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. This is an instance of class 'Derived1'.
            d2.x;           // Error, isn't accessed through an instance of the enclosing class
               ~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. This is an instance of class 'Derived2'.
            d3.x;           // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses
               ~
!!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
            d4.x;           // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class
        }
    }
    
    
    var b: Base;
    var d1: Derived1;
    var d2: Derived2;
    var d3: Derived3;
    var d4: Derived4;
    
    b.x;                    // Error, neither within their declaring class nor classes derived from their declaring class
      ~
!!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
    d1.x;                   // Error, neither within their declaring class nor classes derived from their declaring class
       ~
!!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
    d2.x;                   // Error, neither within their declaring class nor classes derived from their declaring class
       ~
!!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
    d3.x;                   // Error, neither within their declaring class nor classes derived from their declaring class
       ~
!!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
    d4.x;                   // Error, neither within their declaring class nor classes derived from their declaring class
       ~
!!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.