forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
classUpdateTests.errors.txt
180 lines (158 loc) · 6.17 KB
/
classUpdateTests.errors.txt
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
tests/cases/compiler/classUpdateTests.ts(34,2): error TS2377: Constructors for derived classes must contain a 'super' call.
tests/cases/compiler/classUpdateTests.ts(43,18): error TS2335: 'super' can only be referenced in a derived class.
tests/cases/compiler/classUpdateTests.ts(57,2): error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties, parameter properties, or private identifiers.
tests/cases/compiler/classUpdateTests.ts(63,7): error TS2415: Class 'L' incorrectly extends base class 'G'.
Property 'p1' is private in type 'L' but not in type 'G'.
tests/cases/compiler/classUpdateTests.ts(69,7): error TS2415: Class 'M' incorrectly extends base class 'G'.
Property 'p1' is private in type 'M' but not in type 'G'.
tests/cases/compiler/classUpdateTests.ts(70,2): error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties, parameter properties, or private identifiers.
tests/cases/compiler/classUpdateTests.ts(93,3): error TS1128: Declaration or statement expected.
tests/cases/compiler/classUpdateTests.ts(95,1): error TS1128: Declaration or statement expected.
tests/cases/compiler/classUpdateTests.ts(99,3): error TS1128: Declaration or statement expected.
tests/cases/compiler/classUpdateTests.ts(101,1): error TS1128: Declaration or statement expected.
tests/cases/compiler/classUpdateTests.ts(105,3): error TS1128: Declaration or statement expected.
tests/cases/compiler/classUpdateTests.ts(105,10): error TS1434: Unexpected keyword or identifier.
tests/cases/compiler/classUpdateTests.ts(105,14): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/compiler/classUpdateTests.ts(107,1): error TS1128: Declaration or statement expected.
tests/cases/compiler/classUpdateTests.ts(111,3): error TS1128: Declaration or statement expected.
tests/cases/compiler/classUpdateTests.ts(111,11): error TS1434: Unexpected keyword or identifier.
tests/cases/compiler/classUpdateTests.ts(111,15): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/compiler/classUpdateTests.ts(113,1): error TS1128: Declaration or statement expected.
==== tests/cases/compiler/classUpdateTests.ts (18 errors) ====
//
// test codegen for instance properties
//
class A {
public p1 = 0;
private p2 = 0;
p3;
}
class B {
public p1 = 0;
private p2 = 0;
p3;
constructor() {}
}
class C {
constructor(public p1=0, private p2=0, p3=0) {}
}
//
// test requirements for super calls
//
class D { // NO ERROR
}
class E extends D { // NO ERROR
public p1 = 0;
}
class F extends E {
constructor() {} // ERROR - super call required
~~~~~~~~~~~~~~~~
!!! error TS2377: Constructors for derived classes must contain a 'super' call.
}
class G extends D {
public p1 = 0;
constructor() { super(); } // NO ERROR
}
class H {
constructor() { super(); } // ERROR - no super call allowed
~~~~~
!!! error TS2335: 'super' can only be referenced in a derived class.
}
class I extends Object {
constructor() { super(); } // ERROR - no super call allowed
}
class J extends G {
constructor(public p1:number) {
super(); // NO ERROR
}
}
class K extends G {
constructor(public p1:number) { // ERROR
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var i = 0;
~~~~~~~~~~~~
super();
~~~~~~~~~~
}
~~
!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties, parameter properties, or private identifiers.
}
class L extends G {
~
!!! error TS2415: Class 'L' incorrectly extends base class 'G'.
!!! error TS2415: Property 'p1' is private in type 'L' but not in type 'G'.
constructor(private p1:number) {
super(); // NO ERROR
}
}
class M extends G {
~
!!! error TS2415: Class 'M' incorrectly extends base class 'G'.
!!! error TS2415: Property 'p1' is private in type 'M' but not in type 'G'.
constructor(private p1:number) { // ERROR
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var i = 0;
~~~~~~~~~~~~
super();
~~~~~~~~~~
}
~~
!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties, parameter properties, or private identifiers.
}
//
// test this reference in field initializers
//
class N {
public p1 = 0;
public p2 = this.p1;
constructor() {
this.p2 = 0;
}
}
//
// test error on property declarations within class constructors
//
class O {
constructor() {
public p1 = 0; // ERROR
~~~~~~
!!! error TS1128: Declaration or statement expected.
}
}
~
!!! error TS1128: Declaration or statement expected.
class P {
constructor() {
private p1 = 0; // ERROR
~~~~~~~
!!! error TS1128: Declaration or statement expected.
}
}
~
!!! error TS1128: Declaration or statement expected.
class Q {
constructor() {
public this.p1 = 0; // ERROR
~~~~~~
!!! error TS1128: Declaration or statement expected.
~~~~
!!! error TS1434: Unexpected keyword or identifier.
~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
}
}
~
!!! error TS1128: Declaration or statement expected.
class R {
constructor() {
private this.p1 = 0; // ERROR
~~~~~~~
!!! error TS1128: Declaration or statement expected.
~~~~
!!! error TS1434: Unexpected keyword or identifier.
~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
}
}
~
!!! error TS1128: Declaration or statement expected.