Skip to content

Commit 6234640

Browse files
committed
Split parser diagnostic and binder diagnostic
1 parent aa28986 commit 6234640

10 files changed

+351
-363
lines changed
Lines changed: 38 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,76 @@
1-
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(16,5): error TS18037: Await expression cannot be used inside a class static block.
2-
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(16,10): error TS1109: Expression expected.
3-
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(19,5): error TS18037: Await expression cannot be used inside a class static block.
4-
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(28,14): error TS1005: ':' expected.
5-
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(31,9): error TS18037: Await expression cannot be used inside a class static block.
6-
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(31,14): error TS1109: Expression expected.
7-
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(37,10): error TS18037: Await expression cannot be used inside a class static block.
8-
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(37,15): error TS1109: Expression expected.
9-
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(53,5): error TS18037: Await expression cannot be used inside a class static block.
10-
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(53,10): error TS1109: Expression expected.
11-
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(54,15): error TS1003: Identifier expected.
12-
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(54,15): error TS18037: Await expression cannot be used inside a class static block.
13-
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(54,20): error TS1109: Expression expected.
14-
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(87,17): error TS18037: Await expression cannot be used inside a class static block.
15-
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(87,22): error TS1109: Expression expected.
16-
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(87,24): error TS1005: ';' expected.
17-
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(88,17): error TS18037: Await expression cannot be used inside a class static block.
18-
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(88,23): error TS1109: Expression expected.
1+
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(4,9): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here.
2+
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(7,11): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here.
3+
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(13,9): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here.
4+
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(16,14): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here.
5+
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(19,11): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here.
6+
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(29,15): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here.
7+
tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(32,12): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here.
198

209

21-
==== tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts (18 errors) ====
10+
==== tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts (7 errors) ====
2211
let await: "any";
2312
class C {
2413
static {
2514
let await: any; // illegal, cannot declare a new binding for await
15+
~~~~~
16+
!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here.
2617
}
2718
static {
2819
let { await } = {} as any; // illegal, cannot declare a new binding for await
20+
~~~~~
21+
!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here.
2922
}
3023
static {
3124
let { await: other } = {} as any; // legal
3225
}
3326
static {
3427
let await; // illegal, cannot declare a new binding for await
28+
~~~~~
29+
!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here.
3530
}
3631
static {
37-
await; // illegal
38-
~~~~~
39-
!!! error TS18037: Await expression cannot be used inside a class static block.
40-
~
41-
!!! error TS1109: Expression expected.
42-
}
43-
static {
44-
await(1); // illegal
45-
~~~~~~~~
46-
!!! error TS18037: Await expression cannot be used inside a class static block.
47-
}
48-
static {
49-
function await() {}; // illegal
50-
}
51-
static {
52-
class await {}; // illegal
53-
}
54-
static {
55-
({ await }); // illegal short-hand property reference
56-
~
57-
!!! error TS1005: ':' expected.
32+
function await() { }; // illegal
33+
~~~~~
34+
!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here.
5835
}
5936
static {
60-
({ [await]: 1 }); // illegal
61-
~~~~~
62-
!!! error TS18037: Await expression cannot be used inside a class static block.
63-
~
64-
!!! error TS1109: Expression expected.
37+
class await { }; // illegal
38+
~~~~~
39+
!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here.
6540
}
41+
6642
static {
6743
class D {
68-
await = 1; // legal
69-
x = await; // legal (initializers have an implicit function boundary)
70-
[await] = 1; // illegal (computed property names are evaluated outside of a class body
71-
~~~~~
72-
!!! error TS18037: Await expression cannot be used inside a class static block.
73-
~
74-
!!! error TS1109: Expression expected.
75-
};
44+
await = 1; // legal
45+
x = await; // legal (initializers have an implicit function boundary)
46+
};
7647
}
7748
static {
78-
(function await() {}); // legal, 'await' in function expression name not bound inside of static block
49+
(function await() { }); // legal, 'await' in function expression name not bound inside of static block
50+
~~~~~
51+
!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here.
7952
}
8053
static {
81-
(class await {}); // legal, 'await' in class expression name not bound inside of static block
54+
(class await { }); // legal, 'await' in class expression name not bound inside of static block
55+
~~~~~
56+
!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here.
8257
}
8358
static {
8459
(function () { return await; }); // legal, 'await' is inside of a new function boundary
8560
}
8661
static {
8762
(() => await); // legal, 'await' is inside of a new function boundary
8863
}
89-
static {
90-
await: // illegal, 'await' cannot be used as a label
91-
~~~~~
92-
!!! error TS18037: Await expression cannot be used inside a class static block.
93-
~
94-
!!! error TS1109: Expression expected.
95-
break await; // illegal, 'await' cannot be used as a label
96-
~~~~~
97-
!!! error TS1003: Identifier expected.
98-
~~~~~
99-
!!! error TS18037: Await expression cannot be used inside a class static block.
100-
~
101-
!!! error TS1109: Expression expected.
102-
}
64+
10365
static {
10466
class E {
105-
constructor () { await; }
106-
method () { await; }
107-
get accessor () {
67+
constructor() { await; }
68+
method() { await; }
69+
get accessor() {
10870
await;
10971
return 1;
11072
}
111-
set accessor (v: any) {
73+
set accessor(v: any) {
11274
await;
11375
}
11476
propLambda = () => { await; }
@@ -117,31 +79,16 @@ tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(88,23): e
11779
}
11880
static {
11981
class S {
120-
static method () { await; }
121-
static get accessor () {
82+
static method() { await; }
83+
static get accessor() {
12284
await;
12385
return 1;
12486
}
125-
static set accessor (v: any) {
87+
static set accessor(v: any) {
12688
await;
12789
}
12890
static propLambda = () => { await; }
12991
static propFunc = function () { await; }
13092
}
13193
}
132-
static {
133-
function f (await) {}
134-
const ff = (await) => {}
135-
~~~~~
136-
!!! error TS18037: Await expression cannot be used inside a class static block.
137-
~
138-
!!! error TS1109: Expression expected.
139-
~~
140-
!!! error TS1005: ';' expected.
141-
const fff = await => {}
142-
~~~~~
143-
!!! error TS18037: Await expression cannot be used inside a class static block.
144-
~~
145-
!!! error TS1109: Expression expected.
146-
}
14794
}

tests/baselines/reference/classStaticBlock22.js

Lines changed: 16 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -14,55 +14,40 @@ class C {
1414
let await; // illegal, cannot declare a new binding for await
1515
}
1616
static {
17-
await; // illegal
17+
function await() { }; // illegal
1818
}
1919
static {
20-
await(1); // illegal
21-
}
22-
static {
23-
function await() {}; // illegal
24-
}
25-
static {
26-
class await {}; // illegal
27-
}
28-
static {
29-
({ await }); // illegal short-hand property reference
30-
}
31-
static {
32-
({ [await]: 1 }); // illegal
20+
class await { }; // illegal
3321
}
22+
3423
static {
3524
class D {
36-
await = 1; // legal
37-
x = await; // legal (initializers have an implicit function boundary)
38-
[await] = 1; // illegal (computed property names are evaluated outside of a class body
39-
};
25+
await = 1; // legal
26+
x = await; // legal (initializers have an implicit function boundary)
27+
};
4028
}
4129
static {
42-
(function await() {}); // legal, 'await' in function expression name not bound inside of static block
30+
(function await() { }); // legal, 'await' in function expression name not bound inside of static block
4331
}
4432
static {
45-
(class await {}); // legal, 'await' in class expression name not bound inside of static block
33+
(class await { }); // legal, 'await' in class expression name not bound inside of static block
4634
}
4735
static {
4836
(function () { return await; }); // legal, 'await' is inside of a new function boundary
4937
}
5038
static {
5139
(() => await); // legal, 'await' is inside of a new function boundary
5240
}
53-
static {
54-
await: // illegal, 'await' cannot be used as a label
55-
break await; // illegal, 'await' cannot be used as a label
56-
}
41+
5742
static {
5843
class E {
59-
constructor () { await; }
60-
method () { await; }
61-
get accessor () {
44+
constructor() { await; }
45+
method() { await; }
46+
get accessor() {
6247
await;
6348
return 1;
6449
}
65-
set accessor (v: any) {
50+
set accessor(v: any) {
6651
await;
6752
}
6853
propLambda = () => { await; }
@@ -71,23 +56,18 @@ class C {
7156
}
7257
static {
7358
class S {
74-
static method () { await; }
75-
static get accessor () {
59+
static method() { await; }
60+
static get accessor() {
7661
await;
7762
return 1;
7863
}
79-
static set accessor (v: any) {
64+
static set accessor(v: any) {
8065
await;
8166
}
8267
static propLambda = () => { await; }
8368
static propFunc = function () { await; }
8469
}
8570
}
86-
static {
87-
function f (await) {}
88-
const ff = (await) => {}
89-
const fff = await => {}
90-
}
9171
}
9272

9373
//// [classStaticBlock22.js]
@@ -105,12 +85,6 @@ class C {
10585
static {
10686
let await; // illegal, cannot declare a new binding for await
10787
}
108-
static {
109-
await ; // illegal
110-
}
111-
static {
112-
await (1); // illegal
113-
}
11488
static {
11589
function await() { }
11690
; // illegal
@@ -120,17 +94,10 @@ class C {
12094
}
12195
; // illegal
12296
}
123-
static {
124-
({ await: }); // illegal short-hand property reference
125-
}
126-
static {
127-
({ [await ]: 1 }); // illegal
128-
}
12997
static {
13098
class D {
13199
await = 1; // legal
132100
x = await; // legal (initializers have an implicit function boundary)
133-
[await ] = 1; // illegal (computed property names are evaluated outside of a class body
134101
}
135102
;
136103
}
@@ -147,11 +114,6 @@ class C {
147114
static {
148115
(() => await); // legal, 'await' is inside of a new function boundary
149116
}
150-
static {
151-
await ;
152-
break ;
153-
await ; // illegal, 'await' cannot be used as a label
154-
}
155117
static {
156118
class E {
157119
constructor() { await; }
@@ -181,11 +143,4 @@ class C {
181143
static propFunc = function () { await; };
182144
}
183145
}
184-
static {
185-
function f(await) { }
186-
const ff = (await );
187-
{ }
188-
const fff = await ;
189-
{ }
190-
}
191146
}

0 commit comments

Comments
 (0)