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
Fix parser failures found by source alteration in test cases
These parser failures were found by #1340.
- There was one round-trip failure introduced by #1464
- A few cases were just consume tokens as the wrong child
- The list of expected token kinds of `DeclModifierSynax` didn’t contain one modifier that was actually parsed
Copy file name to clipboardExpand all lines: Tests/SwiftParserTest/translated/AvailabilityQueryUnavailabilityTests.swift
+25-9Lines changed: 25 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -436,29 +436,33 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase {
436
436
func testAvailabilityQueryUnavailability34a(){
437
437
assertParse(
438
438
"""
439
-
// Diagnose wrong spellings of unavailability
440
439
if #available(*) 1️⃣== false {
441
440
}
442
441
""",
443
442
diagnostics:[
444
443
DiagnosticSpec(message:"#available cannot be used as an expression, did you mean to use '#unavailable'?", fixIts:["replace '#available(*) == false' with '#unavailable(*)'"])
445
-
]
444
+
],
445
+
fixedSource:"""
446
+
if #unavailable(*) {
447
+
}
448
+
"""
446
449
)
447
450
}
448
451
449
452
func testAvailabilityQueryUnavailability34b(){
450
453
assertParse(
451
454
"""
452
-
// Diagnose wrong spellings of unavailability
453
-
if #available(*) 1️⃣== false && 2️⃣true {
455
+
if #available(*) 1️⃣== false 2️⃣&& true {
454
456
}
455
457
""",
456
458
diagnostics:[
457
-
DiagnosticSpec(locationMarker:"1️⃣", message:"unexpected code '== false &&' in 'if' statement"),
458
-
DiagnosticSpec(locationMarker:"2️⃣", message:"expected ',' in 'if' statement", fixIts:["insert ','"]),
459
-
// TODO: Old parser expected error on line 2: #available cannot be used as an expression, did you mean to use '#unavailable'?, Fix-It replacements: 4 - 14 = '#unavailable', 18 - 27 = ''
460
-
// TODO: Old parser expected error on line 2: expected ',' joining parts of a multi-clause condition, Fix-It replacements: 27 - 28 = ','
461
-
]
459
+
DiagnosticSpec(locationMarker:"1️⃣", message:"#available cannot be used as an expression, did you mean to use '#unavailable'?"),
460
+
DiagnosticSpec(locationMarker:"2️⃣", message:"expected ',' joining parts of a multi-clause condition", fixIts:["replace '&&' with ','"]),
461
+
],
462
+
fixedSource:"""
463
+
if #unavailable(*) , true {
464
+
}
465
+
"""
462
466
)
463
467
}
464
468
@@ -473,4 +477,16 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase {
473
477
]
474
478
)
475
479
}
480
+
481
+
func testAvailabilityQueryUnavailability34d(){
482
+
assertParse(
483
+
"""
484
+
if #available(*) 1️⃣== {
485
+
}
486
+
""",
487
+
diagnostics:[
488
+
DiagnosticSpec(locationMarker:"1️⃣", message:"unexpected code '==' in 'if' statement")
0 commit comments