@@ -13,27 +13,40 @@ final class NumberIdentifierErrorsTests: XCTestCase {
13
13
)
14
14
}
15
15
16
- func testNumberIdentifierErrors2 ( ) {
16
+ func testNumberIdentifierErrors2a ( ) {
17
17
AssertParse (
18
18
"""
19
19
func 1️⃣1() {}
20
- func 2️⃣2.0() {}
21
- func 3️⃣3func() {}
22
20
""" ,
23
21
diagnostics: [
24
- // TODO: Old parser expected error on line 1: function name can only start with a letter or underscore, not a number
25
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected name in function " ) ,
26
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " unexpected code '1' before parameter clause " ) ,
27
- // TODO: Old parser expected error on line 2: function name can only start with a letter or underscore, not a number
28
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected name in function " ) ,
29
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " unexpected code '2.0' before parameter clause " ) ,
30
- // TODO: Old parser expected error on line 3: function name can only start with a letter or underscore, not a number
31
- // TODO: Old parser expected error on line 3: 'f' is not a valid digit in integer literal
32
- DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " identifier can only start with a letter or underscore, not a number " ) ,
22
+ DiagnosticSpec ( message: " name can only start with a letter or underscore, not a number " ) ,
33
23
]
34
24
)
35
25
}
36
26
27
+ func testNumberIdentifierErrors2b( ) {
28
+ AssertParse (
29
+ """
30
+ func 1️⃣2.0() {}
31
+ """ ,
32
+ diagnostics: [
33
+ DiagnosticSpec ( message: " name can only start with a letter or underscore, not a number " ) ,
34
+ ]
35
+ )
36
+ }
37
+
38
+ func testNumberIdentifierErrors2c( ) {
39
+ AssertParse (
40
+ """
41
+ func 1️⃣3func() {}
42
+ """ ,
43
+ diagnostics: [
44
+ DiagnosticSpec ( message: " name can only start with a letter or underscore, not a number " ) ,
45
+ ]
46
+ )
47
+ }
48
+
49
+
37
50
func testNumberIdentifierErrors3a( ) {
38
51
AssertParse (
39
52
"""
@@ -42,10 +55,8 @@ final class NumberIdentifierErrorsTests: XCTestCase {
42
55
}
43
56
""" ,
44
57
diagnostics: [
45
- // TODO: Old parser expected error on line 1: protocol name can only start with a letter or underscore, not a number
46
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected name and member block in protocol " ) ,
47
- // TODO: Old parser expected error on line 2: associatedtype name can only start with a letter or underscore, not a number
48
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected name in associatedtype declaration " ) ,
58
+ DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " name can only start with a letter or underscore, not a number " ) ,
59
+ DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " name can only start with a letter or underscore, not a number " ) ,
49
60
]
50
61
)
51
62
}
@@ -58,10 +69,8 @@ final class NumberIdentifierErrorsTests: XCTestCase {
58
69
}
59
70
""" ,
60
71
diagnostics: [
61
- // TODO: Old parser expected error on line 1: protocol name can only start with a letter or underscore, not a number
62
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected name and member block in protocol " ) ,
63
- // TODO: Old parser expected error on line 2: associatedtype name can only start with a letter or underscore, not a number
64
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected name in associatedtype declaration " ) ,
72
+ DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " name can only start with a letter or underscore, not a number " ) ,
73
+ DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " name can only start with a letter or underscore, not a number " ) ,
65
74
]
66
75
)
67
76
}
@@ -74,34 +83,42 @@ final class NumberIdentifierErrorsTests: XCTestCase {
74
83
}
75
84
""" ,
76
85
diagnostics: [
77
- // TODO: Old parser expected error on line 1: protocol name can only start with a letter or underscore, not a number
78
- // TODO: Old parser expected error on line 1: 'p' is not a valid digit in integer literal
79
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " identifier can only start with a letter or underscore, not a number " ) ,
80
- // TODO: Old parser expected error on line 2: associatedtype name can only start with a letter or underscore, not a number
81
- // TODO: Old parser expected error on line 2: 'a' is not a valid digit in integer literal
82
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " identifier can only start with a letter or underscore, not a number " ) ,
86
+ DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " name can only start with a letter or underscore, not a number " ) ,
87
+ DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " name can only start with a letter or underscore, not a number " ) ,
83
88
]
84
89
)
85
90
}
86
91
87
92
88
- func testNumberIdentifierErrors4 ( ) {
93
+ func testNumberIdentifierErrors4a ( ) {
89
94
AssertParse (
90
95
"""
91
96
typealias 1️⃣10 = Int
92
- typealias 2️⃣11.0 = Int
93
- typealias 3️⃣12typealias = Int
94
97
""" ,
95
98
diagnostics: [
96
- // TODO: Old parser expected error on line 1: typealias name can only start with a letter or underscore, not a number
97
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected name in typealias declaration " ) ,
98
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " unexpected code '10' in typealias declaration " ) ,
99
- // TODO: Old parser expected error on line 2: typealias name can only start with a letter or underscore, not a number
100
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected name in typealias declaration " ) ,
101
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " unexpected code '11.0' in typealias declaration " ) ,
102
- // TODO: Old parser expected error on line 3: typealias name can only start with a letter or underscore, not a number
103
- // TODO: Old parser expected error on line 3: 't' is not a valid digit in integer literal
104
- DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " identifier can only start with a letter or underscore, not a number " ) ,
99
+ DiagnosticSpec ( message: " name can only start with a letter or underscore, not a number " ) ,
100
+ ]
101
+ )
102
+ }
103
+
104
+ func testNumberIdentifierErrors4b( ) {
105
+ AssertParse (
106
+ """
107
+ typealias 1️⃣11.0 = Int
108
+ """ ,
109
+ diagnostics: [
110
+ DiagnosticSpec ( message: " name can only start with a letter or underscore, not a number " ) ,
111
+ ]
112
+ )
113
+ }
114
+
115
+ func testNumberIdentifierErrors4c( ) {
116
+ AssertParse (
117
+ """
118
+ typealias 1️⃣12typealias = Int
119
+ """ ,
120
+ diagnostics: [
121
+ DiagnosticSpec ( message: " name can only start with a letter or underscore, not a number " ) ,
105
122
]
106
123
)
107
124
}
@@ -112,8 +129,7 @@ final class NumberIdentifierErrorsTests: XCTestCase {
112
129
struct 1️⃣13 {}
113
130
""" ,
114
131
diagnostics: [
115
- // TODO: Old parser expected error on line 1: struct name can only start with a letter or underscore, not a number
116
- DiagnosticSpec ( message: " expected name and member block in struct " ) ,
132
+ DiagnosticSpec ( message: " name can only start with a letter or underscore, not a number " ) ,
117
133
]
118
134
)
119
135
}
@@ -124,8 +140,7 @@ final class NumberIdentifierErrorsTests: XCTestCase {
124
140
struct 1️⃣14.0 {}
125
141
""" ,
126
142
diagnostics: [
127
- // TODO: Old parser expected error on line 1: struct name can only start with a letter or underscore, not a number
128
- DiagnosticSpec ( message: " expected name and member block in struct " ) ,
143
+ DiagnosticSpec ( message: " name can only start with a letter or underscore, not a number " ) ,
129
144
]
130
145
)
131
146
}
@@ -136,9 +151,7 @@ final class NumberIdentifierErrorsTests: XCTestCase {
136
151
struct 1️⃣15struct {}
137
152
""" ,
138
153
diagnostics: [
139
- // TODO: Old parser expected error on line 1: struct name can only start with a letter or underscore, not a number
140
- // TODO: Old parser expected error on line 1: 's' is not a valid digit in integer literal
141
- DiagnosticSpec ( message: " identifier can only start with a letter or underscore, not a number " ) ,
154
+ DiagnosticSpec ( message: " name can only start with a letter or underscore, not a number " ) ,
142
155
]
143
156
)
144
157
}
@@ -149,8 +162,7 @@ final class NumberIdentifierErrorsTests: XCTestCase {
149
162
enum 1️⃣16 {}
150
163
""" ,
151
164
diagnostics: [
152
- // TODO: Old parser expected error on line 1: enum name can only start with a letter or underscore, not a number
153
- DiagnosticSpec ( message: " expected name and member block in enum " ) ,
165
+ DiagnosticSpec ( message: " name can only start with a letter or underscore, not a number " ) ,
154
166
]
155
167
)
156
168
}
@@ -161,8 +173,7 @@ final class NumberIdentifierErrorsTests: XCTestCase {
161
173
enum 1️⃣17.0 {}
162
174
""" ,
163
175
diagnostics: [
164
- // TODO: Old parser expected error on line 1: enum name can only start with a letter or underscore, not a number
165
- DiagnosticSpec ( message: " expected name and member block in enum " ) ,
176
+ DiagnosticSpec ( message: " name can only start with a letter or underscore, not a number " ) ,
166
177
]
167
178
)
168
179
}
@@ -173,9 +184,7 @@ final class NumberIdentifierErrorsTests: XCTestCase {
173
184
enum 1️⃣18enum {}
174
185
""" ,
175
186
diagnostics: [
176
- // TODO: Old parser expected error on line 1: enum name can only start with a letter or underscore, not a number
177
- // TODO: Old parser expected error on line 1: 'n' is not a valid digit in floating point exponent
178
- DiagnosticSpec ( message: " identifier can only start with a letter or underscore, not a number " ) ,
187
+ DiagnosticSpec ( message: " name can only start with a letter or underscore, not a number " ) ,
179
188
]
180
189
)
181
190
}
@@ -188,11 +197,8 @@ final class NumberIdentifierErrorsTests: XCTestCase {
188
197
}
189
198
""" ,
190
199
diagnostics: [
191
- // TODO: Old parser expected error on line 1: class name can only start with a letter or underscore, not a number
192
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected name and member block in class " ) ,
193
- // TODO: Old parser expected error on line 2: function name can only start with a letter or underscore, not a number
194
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected name in function " ) ,
195
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " unexpected code '20' before parameter clause " ) ,
200
+ DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " name can only start with a letter or underscore, not a number " ) ,
201
+ DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " name can only start with a letter or underscore, not a number " ) ,
196
202
]
197
203
)
198
204
}
@@ -205,11 +211,8 @@ final class NumberIdentifierErrorsTests: XCTestCase {
205
211
}
206
212
""" ,
207
213
diagnostics: [
208
- // TODO: Old parser expected error on line 1: class name can only start with a letter or underscore, not a number
209
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected name and member block in class " ) ,
210
- // TODO: Old parser expected error on line 2: function name can only start with a letter or underscore, not a number
211
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected name in function " ) ,
212
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " unexpected code '22.0' before parameter clause " ) ,
214
+ DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " name can only start with a letter or underscore, not a number " ) ,
215
+ DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " name can only start with a letter or underscore, not a number " ) ,
213
216
]
214
217
)
215
218
}
@@ -223,12 +226,8 @@ final class NumberIdentifierErrorsTests: XCTestCase {
223
226
}
224
227
""" ,
225
228
diagnostics: [
226
- // TODO: Old parser expected error on line 1: class name can only start with a letter or underscore, not a number
227
- // TODO: Old parser expected error on line 1: 'c' is not a valid digit in integer literal
228
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " identifier can only start with a letter or underscore, not a number " ) ,
229
- // TODO: Old parser expected error on line 2: function name can only start with a letter or underscore, not a number
230
- // TODO: Old parser expected error on line 2: 'm' is not a valid digit in integer literal
231
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " identifier can only start with a letter or underscore, not a number " ) ,
229
+ DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " name can only start with a letter or underscore, not a number " ) ,
230
+ DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " name can only start with a letter or underscore, not a number " ) ,
232
231
]
233
232
)
234
233
}
0 commit comments