@@ -613,20 +613,20 @@ final class RecoveryTests: XCTestCase {
613
613
switch1️⃣
614
614
""" ,
615
615
diagnostics: [
616
- DiagnosticSpec ( message: " expected expression and '{}' to end 'switch' statement " )
616
+ DiagnosticSpec ( locationMarker : " 1️⃣ " , message: " expected expression and '{}' to end 'switch' statement " )
617
617
]
618
618
)
619
619
}
620
620
621
621
func testRecovery46( ) {
622
622
AssertParse (
623
623
"""
624
- switch 1️⃣{
624
+ switch 1️⃣{2️⃣
625
625
}
626
626
""" ,
627
627
diagnostics: [
628
- DiagnosticSpec ( message: " expected expression in 'switch' statement " )
629
- // TODO: Old parser expected error on line 1: 'switch' statement body must have at least one 'case' or 'default' block
628
+ DiagnosticSpec ( locationMarker : " 1️⃣ " , message: " expected expression in 'switch' statement " ) ,
629
+ DiagnosticSpec ( locationMarker : " 2️⃣ " , message : " 'switch' statement body must have at least one 'case' or 'default' block " ) ,
630
630
]
631
631
)
632
632
}
@@ -635,12 +635,12 @@ final class RecoveryTests: XCTestCase {
635
635
AssertParse (
636
636
"""
637
637
switch 1️⃣
638
- {
638
+ {2️⃣
639
639
}
640
640
""" ,
641
641
diagnostics: [
642
- DiagnosticSpec ( message: " expected expression in 'switch' statement " )
643
- // TODO: Old parser expected error on line 1: 'switch' statement body must have at least one 'case' or 'default' block
642
+ DiagnosticSpec ( locationMarker : " 1️⃣ " , message: " expected expression in 'switch' statement " ) ,
643
+ DiagnosticSpec ( locationMarker : " 2️⃣ " , message : " 'switch' statement body must have at least one 'case' or 'default' block " ) ,
644
644
]
645
645
)
646
646
}
@@ -667,36 +667,39 @@ final class RecoveryTests: XCTestCase {
667
667
}
668
668
""" ,
669
669
diagnostics: [
670
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected expression in 'switch' statement " ) ,
670
+ DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected expression in 'switch' statement " )
671
671
// TODO: Old parser expected error on line 2: 'is' keyword required to pattern match against type name, Fix-It replacements: 10 - 10 = 'is '
672
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " 'case' can only appear inside a 'switch' statement or 'enum' declaration " ) ,
673
- DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " 'case' can only appear inside a 'switch' statement or 'enum' declaration " ) ,
674
672
]
675
673
)
676
674
}
677
675
678
676
func testRecovery50( ) {
679
677
AssertParse (
680
678
"""
681
- switch 1️⃣{ 42 } {
682
- case _: return
679
+ switch 1️⃣{ 2️⃣42 } {
680
+ 3️⃣case _: return
683
681
}
684
682
""" ,
685
683
diagnostics: [
686
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected expression in 'switch' statement " )
684
+ DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected expression in 'switch' statement " ) ,
685
+ DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " all statements inside a switch must be covered by a 'case' or 'default' label " ) ,
686
+ DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " 'case' can only appear inside a 'switch' statement or 'enum' declaration " ) ,
687
687
]
688
688
)
689
689
}
690
690
691
691
func testRecovery51( ) {
692
692
AssertParse (
693
693
"""
694
- switch 1️⃣{ 42 }() {
695
- case _: return
694
+ switch 1️⃣{ 2️⃣42 }()3️⃣ {
695
+ 4️⃣case _: return
696
696
}
697
697
""" ,
698
698
diagnostics: [
699
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected expression in 'switch' statement " )
699
+ DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected expression in 'switch' statement " ) ,
700
+ DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " all statements inside a switch must be covered by a 'case' or 'default' label " ) ,
701
+ DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " consecutive statements on a line must be separated by ';' " ) ,
702
+ DiagnosticSpec ( locationMarker: " 4️⃣ " , message: " 'case' can only appear inside a 'switch' statement or 'enum' declaration " ) ,
700
703
]
701
704
)
702
705
}
0 commit comments