You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Tests/SwiftParserTest/translated/RecoveryTests.swift
+22-5Lines changed: 22 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1206,13 +1206,14 @@ final class RecoveryTests: XCTestCase {
1206
1206
func bar() -> Int3️⃣] {
1207
1207
return [0]
1208
1208
}
1209
-
}
1209
+
4️⃣}
1210
1210
""",
1211
1211
diagnostics:[
1212
1212
DiagnosticSpec(locationMarker:"1️⃣", message:"expected '}' to end struct"),
1213
1213
DiagnosticSpec(locationMarker:"2️⃣", message:"expected ']' to end array"),
1214
1214
// TODO: Old parser expected error on line 5: unexpected ']' in type; did you mean to write an array type?, Fix-It replacements: 17 - 17 = '['
1215
-
DiagnosticSpec(locationMarker:"3️⃣", message:"extraneous code at top level"),
1215
+
DiagnosticSpec(locationMarker:"3️⃣", message:"unexpected code ']' in function"),
1216
+
DiagnosticSpec(locationMarker:"4️⃣", message:"extraneous brace at top level"),
1216
1217
]
1217
1218
)
1218
1219
}
@@ -1247,7 +1248,7 @@ final class RecoveryTests: XCTestCase {
1247
1248
""",
1248
1249
diagnostics:[
1249
1250
// TODO: Old parser expected error on line 2: array types are now written with the brackets around the element type, Fix-It replacements: 17 - 17 = '[', 20 - 21 = ''
1250
-
DiagnosticSpec(message:"unexpected code in struct")
1251
+
DiagnosticSpec(message:"unexpected code '[0]' in function")
1251
1252
]
1252
1253
)
1253
1254
}
@@ -1263,7 +1264,7 @@ final class RecoveryTests: XCTestCase {
1263
1264
""",
1264
1265
diagnostics:[
1265
1266
// TODO: Old parser expected error on line 2: array types are now written with the brackets around the element type, Fix-It replacements: 17 - 17 = '[', 20 - 21 = ''
1266
-
DiagnosticSpec(message:"unexpected code in struct")
1267
+
DiagnosticSpec(message:"unexpected code '[0_1]' in function")
1267
1268
]
1268
1269
)
1269
1270
}
@@ -1279,7 +1280,7 @@ final class RecoveryTests: XCTestCase {
1279
1280
""",
1280
1281
diagnostics:[
1281
1282
// TODO: Old parser expected error on line 2: array types are now written with the brackets around the element type, Fix-It replacements: 17 - 17 = '[', 20 - 21 = ''
1282
-
DiagnosticSpec(message:"unexpected code in struct")
1283
+
DiagnosticSpec(message:"unexpected code '[0b1]' in function")
1283
1284
]
1284
1285
)
1285
1286
}
@@ -2205,4 +2206,20 @@ final class RecoveryTests: XCTestCase {
2205
2206
)
2206
2207
}
2207
2208
2209
+
func testRecovery182(){
2210
+
AssertParse(
2211
+
"func foo() 1️⃣bogus {}",
2212
+
diagnostics:[
2213
+
DiagnosticSpec(message:"unexpected code 'bogus' in function")
2214
+
]
2215
+
)
2216
+
2217
+
AssertParse(
2218
+
"func foo() 1️⃣bogus -> Int {}",
2219
+
diagnostics:[
2220
+
DiagnosticSpec(message:"unexpected code 'bogus' in function signature")
0 commit comments