@@ -174,12 +174,12 @@ final class EffectfulPropertiesTests: XCTestCase {
174
174
assertParse (
175
175
"""
176
176
var bad1 : Int {
177
- get rethrows { 0 }
177
+ get 1️⃣rethrows { 0 }
178
178
set rethrows { }
179
179
}
180
180
""" ,
181
181
diagnostics: [
182
- // TODO: Old parser expected error on line 2: only function declarations may be marked 'rethrows'; did you mean 'throws'?
182
+ DiagnosticSpec ( message : " only function declarations may be marked 'rethrows'; did you mean 'throws'? " )
183
183
]
184
184
)
185
185
}
@@ -244,7 +244,9 @@ final class EffectfulPropertiesTests: XCTestCase {
244
244
}
245
245
""" ,
246
246
diagnostics: [
247
- DiagnosticSpec ( message: " unexpected code 'bogus' before effect specifiers " )
247
+ // TODO: Should produce two diagnostics?
248
+ //DiagnosticSpec(message: "unexpected code 'bogus' before effect specifiers"),
249
+ DiagnosticSpec ( message: " only function declarations may be marked 'rethrows'; did you mean 'throws'? " )
248
250
]
249
251
)
250
252
}
@@ -253,11 +255,12 @@ final class EffectfulPropertiesTests: XCTestCase {
253
255
assertParse (
254
256
"""
255
257
var bad6 : Int {
256
- get rethrows 1️⃣ -> Int { 0 }
258
+ get 1️⃣rethrows 2️⃣ -> Int { 0 }
257
259
}
258
260
""" ,
259
261
diagnostics: [
260
- DiagnosticSpec ( message: " unexpected code '-> Int' in accessor " )
262
+ DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " only function declarations may be marked 'rethrows'; did you mean 'throws'? " ) ,
263
+ DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " unexpected code '-> Int' in accessor " )
261
264
]
262
265
)
263
266
}
@@ -290,20 +293,23 @@ final class EffectfulPropertiesTests: XCTestCase {
290
293
}
291
294
292
295
func testEffectfulProperties20( ) {
296
+ // TODO: diagnostics at 1️⃣ should be valid
293
297
assertParse (
294
298
"""
295
299
protocol BadP {
296
- var prop2 : Int { get 1️⃣bogus rethrows set }
297
- var prop3 : Int { get rethrows 2️⃣bogus set }
298
- var prop4 : Int { get reasync 3️⃣bogus set }
299
- var prop5 : Int { get throws 4️⃣async }
300
+ var prop2 : Int { get 2️⃣bogus rethrows set }
301
+ var prop3 : Int { get 3️⃣rethrows 4️⃣bogus set }
302
+ var prop4 : Int { get reasync 5️⃣bogus set }
303
+ var prop5 : Int { get throws 6️⃣async }
300
304
}
301
305
""" ,
302
306
diagnostics: [
303
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " unexpected code 'bogus' before effect specifiers " ) ,
304
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " unexpected code 'bogus set' in variable " ) ,
305
- DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " unexpected code 'bogus set' in variable " ) ,
306
- DiagnosticSpec ( locationMarker: " 4️⃣ " , message: " 'async' must precede 'throws' " ) ,
307
+ // DiagnosticSpec(locationMarker: "1️⃣", message: "unexpected code 'bogus' before effect specifiers"),
308
+ DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " only function declarations may be marked 'rethrows'; did you mean 'throws'? " ) ,
309
+ DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " only function declarations may be marked 'rethrows'; did you mean 'throws'? " ) ,
310
+ DiagnosticSpec ( locationMarker: " 4️⃣ " , message: " unexpected code 'bogus set' in variable " ) ,
311
+ DiagnosticSpec ( locationMarker: " 5️⃣ " , message: " unexpected code 'bogus set' in variable " ) ,
312
+ DiagnosticSpec ( locationMarker: " 6️⃣ " , message: " 'async' must precede 'throws' " ) ,
307
313
]
308
314
)
309
315
}
0 commit comments