Skip to content

Commit 3c4c781

Browse files
committed
Revert "check without error type"
This reverts commit e2cd9c6.
1 parent 6dc2109 commit 3c4c781

File tree

5 files changed

+79
-103
lines changed

5 files changed

+79
-103
lines changed

internal/checker/checker.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10585,6 +10585,7 @@ func (c *Checker) checkIdentifier(node *ast.Node, checkMode CheckMode) *Type {
1058510585
if symbol == c.argumentsSymbol {
1058610586
if c.isInPropertyInitializerOrClassStaticBlock(node, true /*ignoreArrowFunctions*/) {
1058710587
c.error(node, diagnostics.X_arguments_cannot_be_referenced_in_property_initializers_or_class_static_initialization_blocks)
10588+
return c.errorType
1058810589
}
1058910590
return c.getTypeOfSymbol(symbol)
1059010591
}

testdata/baselines/reference/submodule/compiler/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.types

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ function A() {
99
>T : typeof T
1010

1111
a = arguments
12-
>a : IArguments
13-
>arguments : IArguments
12+
>a : any
13+
>arguments : any
1414
}
1515
}
1616

@@ -23,8 +23,8 @@ function A1() {
2323
>T : typeof T
2424

2525
a = arguments
26-
>a : IArguments
27-
>arguments : IArguments
26+
>a : any
27+
>arguments : any
2828
}
2929
}
3030

@@ -36,10 +36,10 @@ function B() {
3636
>T : typeof T
3737

3838
a = { b: arguments }
39-
>a : { b: IArguments; }
40-
>{ b: arguments } : { b: IArguments; }
41-
>b : IArguments
42-
>arguments : IArguments
39+
>a : { b: any; }
40+
>{ b: arguments } : { b: any; }
41+
>b : any
42+
>arguments : any
4343
}
4444
}
4545

@@ -52,10 +52,10 @@ function B1() {
5252
>T : typeof T
5353

5454
a = { b: arguments }
55-
>a : { b: IArguments; }
56-
>{ b: arguments } : { b: IArguments; }
57-
>b : IArguments
58-
>arguments : IArguments
55+
>a : { b: any; }
56+
>{ b: arguments } : { b: any; }
57+
>b : any
58+
>arguments : any
5959
}
6060
}
6161

@@ -81,9 +81,9 @@ function D() {
8181
>T : typeof T
8282

8383
a = () => arguments // should error
84-
>a : () => IArguments
85-
>() => arguments : () => IArguments
86-
>arguments : IArguments
84+
>a : () => any
85+
>() => arguments : () => any
86+
>arguments : any
8787
}
8888
}
8989

@@ -99,14 +99,14 @@ function D1() {
9999
>() => { arguments; // should error const b = () => { return arguments; // should error } function f() { return arguments; // ok } } : () => void
100100

101101
arguments; // should error
102-
>arguments : IArguments
102+
>arguments : any
103103

104104
const b = () => {
105-
>b : () => IArguments
106-
>() => { return arguments; // should error } : () => IArguments
105+
>b : () => any
106+
>() => { return arguments; // should error } : () => any
107107

108108
return arguments; // should error
109-
>arguments : IArguments
109+
>arguments : any
110110
}
111111

112112
function f() {
@@ -169,13 +169,13 @@ function D3() {
169169

170170
static {
171171
arguments; // should error
172-
>arguments : IArguments
172+
>arguments : any
173173

174174
while(1) {
175175
>1 : 1
176176

177177
arguments // should error
178-
>arguments : IArguments
178+
>arguments : any
179179
}
180180
}
181181
}
@@ -208,11 +208,11 @@ function D5() {
208208
>T : typeof T
209209

210210
a = (() => { return arguments; })() // should error
211-
>a : IArguments
212-
>(() => { return arguments; })() : IArguments
213-
>(() => { return arguments; }) : () => IArguments
214-
>() => { return arguments; } : () => IArguments
215-
>arguments : IArguments
211+
>a : any
212+
>(() => { return arguments; })() : any
213+
>(() => { return arguments; }) : () => any
214+
>() => { return arguments; } : () => any
215+
>arguments : any
216216
}
217217
}
218218

@@ -224,10 +224,10 @@ function D6() {
224224
>T : typeof T
225225

226226
a = (x = arguments) => {} // should error
227-
>a : (x?: IArguments) => void
228-
>(x = arguments) => {} : (x?: IArguments) => void
229-
>x : IArguments
230-
>arguments : IArguments
227+
>a : (x?: any) => void
228+
>(x = arguments) => {} : (x?: any) => void
229+
>x : any
230+
>arguments : any
231231
}
232232
}
233233

Lines changed: 46 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,65 @@
11
--- old.argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.types
22
+++ new.argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.types
3-
@@= skipped -8, +8 lines =@@
3+
@@= skipped -80, +80 lines =@@
44
>T : typeof T
55

6-
a = arguments
7-
->a : any
8-
->arguments : any
9-
+>a : IArguments
10-
+>arguments : IArguments
6+
a = () => arguments // should error
7+
->a : () => IArguments
8+
->() => arguments : () => IArguments
9+
->arguments : IArguments
10+
+>a : () => any
11+
+>() => arguments : () => any
12+
+>arguments : any
1113
}
1214
}
1315

14-
@@= skipped -14, +14 lines =@@
15-
>T : typeof T
16+
@@= skipped -18, +18 lines =@@
17+
>() => { arguments; // should error const b = () => { return arguments; // should error } function f() { return arguments; // ok } } : () => void
1618

17-
a = arguments
18-
->a : any
19-
->arguments : any
20-
+>a : IArguments
21-
+>arguments : IArguments
22-
}
23-
}
19+
arguments; // should error
20+
->arguments : IArguments
21+
+>arguments : any
22+
23+
const b = () => {
24+
->b : () => IArguments
25+
->() => { return arguments; // should error } : () => IArguments
26+
+>b : () => any
27+
+>() => { return arguments; // should error } : () => any
28+
29+
return arguments; // should error
30+
->arguments : IArguments
31+
+>arguments : any
32+
}
2433

25-
@@= skipped -13, +13 lines =@@
34+
function f() {
35+
@@= skipped -109, +109 lines =@@
2636
>T : typeof T
2737

28-
a = { b: arguments }
29-
->a : { b: any; }
30-
->{ b: arguments } : { b: any; }
31-
->b : any
32-
->arguments : any
33-
+>a : { b: IArguments; }
34-
+>{ b: arguments } : { b: IArguments; }
35-
+>b : IArguments
36-
+>arguments : IArguments
38+
a = (() => { return arguments; })() // should error
39+
->a : IArguments
40+
->(() => { return arguments; })() : IArguments
41+
->(() => { return arguments; }) : () => IArguments
42+
->() => { return arguments; } : () => IArguments
43+
->arguments : IArguments
44+
+>a : any
45+
+>(() => { return arguments; })() : any
46+
+>(() => { return arguments; }) : () => any
47+
+>() => { return arguments; } : () => any
48+
+>arguments : any
3749
}
3850
}
3951

4052
@@= skipped -16, +16 lines =@@
4153
>T : typeof T
4254

43-
a = { b: arguments }
44-
->a : { b: any; }
45-
->{ b: arguments } : { b: any; }
46-
->b : any
47-
->arguments : any
48-
+>a : { b: IArguments; }
49-
+>{ b: arguments } : { b: IArguments; }
50-
+>b : IArguments
51-
+>arguments : IArguments
55+
a = (x = arguments) => {} // should error
56+
->a : (x?: IArguments) => void
57+
->(x = arguments) => {} : (x?: IArguments) => void
58+
->x : IArguments
59+
->arguments : IArguments
60+
+>a : (x?: any) => void
61+
+>(x = arguments) => {} : (x?: any) => void
62+
+>x : any
63+
+>arguments : any
5264
}
5365
}
54-
55-
@@= skipped -117, +117 lines =@@
56-
57-
static {
58-
arguments; // should error
59-
->arguments : any
60-
+>arguments : IArguments
61-
62-
while(1) {
63-
>1 : 1
64-
65-
arguments // should error
66-
->arguments : any
67-
+>arguments : IArguments
68-
}
69-
}
70-
}

testdata/baselines/reference/submodule/conformance/classStaticBlock6.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async function foo () {
8484

8585
static {
8686
arguments;
87-
>arguments : IArguments
87+
>arguments : any
8888

8989
await;
9090
>await : any
@@ -113,7 +113,7 @@ function foo1 () {
113113

114114
static {
115115
arguments;
116-
>arguments : IArguments
116+
>arguments : any
117117

118118
function ff () {
119119
>ff : () => void

testdata/baselines/reference/submodule/conformance/classStaticBlock6.types.diff

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)