Skip to content

Commit e2cd9c6

Browse files
committed
check without error type
1 parent 4994ad6 commit e2cd9c6

File tree

5 files changed

+103
-79
lines changed

5 files changed

+103
-79
lines changed

internal/checker/checker.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10585,7 +10585,6 @@ 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
1058910588
}
1059010589
return c.getTypeOfSymbol(symbol)
1059110590
}

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 : any
13-
>arguments : any
12+
>a : IArguments
13+
>arguments : IArguments
1414
}
1515
}
1616

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

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

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

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

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

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

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

8383
a = () => arguments // should error
84-
>a : () => any
85-
>() => arguments : () => any
86-
>arguments : any
84+
>a : () => IArguments
85+
>() => arguments : () => IArguments
86+
>arguments : IArguments
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 : any
102+
>arguments : IArguments
103103

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

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

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

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

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

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

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

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

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

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

6-
a = () => arguments // should error
7-
->a : () => IArguments
8-
->() => arguments : () => IArguments
9-
->arguments : IArguments
10-
+>a : () => any
11-
+>() => arguments : () => any
12-
+>arguments : any
6+
a = arguments
7+
->a : any
8+
->arguments : any
9+
+>a : IArguments
10+
+>arguments : IArguments
1311
}
1412
}
1513

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

29-
return arguments; // should error
30-
->arguments : IArguments
31-
+>arguments : any
32-
}
17+
a = arguments
18+
->a : any
19+
->arguments : any
20+
+>a : IArguments
21+
+>arguments : IArguments
22+
}
23+
}
3324

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

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
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
4937
}
5038
}
5139

5240
@@= skipped -16, +16 lines =@@
5341
>T : typeof T
5442

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
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
6452
}
6553
}
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 : any
87+
>arguments : IArguments
8888

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

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

118118
function ff () {
119119
>ff : () => void
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--- old.classStaticBlock6.types
2+
+++ new.classStaticBlock6.types
3+
@@= skipped -83, +83 lines =@@
4+
5+
static {
6+
arguments;
7+
->arguments : any
8+
+>arguments : IArguments
9+
10+
await;
11+
>await : any
12+
@@= skipped -29, +29 lines =@@
13+
14+
static {
15+
arguments;
16+
->arguments : any
17+
+>arguments : IArguments
18+
19+
function ff () {
20+
>ff : () => void

0 commit comments

Comments
 (0)