@@ -621,82 +621,83 @@ final class RecoveryTests: XCTestCase {
621
621
func testRecovery46( ) {
622
622
AssertParse (
623
623
"""
624
- switch {
625
- }1️⃣
624
+ switch 1️⃣ {
625
+ }
626
626
""" ,
627
627
diagnostics: [
628
- // TODO: Old parser expected error on line 1: expected expression in 'switch' statement
628
+ DiagnosticSpec ( message : " expected expression in 'switch' statement " )
629
629
// TODO: Old parser expected error on line 1: 'switch' statement body must have at least one 'case' or 'default' block
630
- DiagnosticSpec ( message: " expected '{}' in 'switch' statement " )
631
630
]
632
631
)
633
632
}
634
633
635
634
func testRecovery47( ) {
636
635
AssertParse (
637
636
"""
638
- switch
637
+ switch 1️⃣
639
638
{
640
- }1️⃣
639
+ }
641
640
""" ,
642
641
diagnostics: [
643
- // TODO: Old parser expected error on line 1: expected expression in 'switch' statement
642
+ DiagnosticSpec ( message : " expected expression in 'switch' statement " )
644
643
// TODO: Old parser expected error on line 1: 'switch' statement body must have at least one 'case' or 'default' block
645
- DiagnosticSpec ( message: " expected '{}' in 'switch' statement " )
646
644
]
647
645
)
648
646
}
649
647
650
648
func testRecovery48( ) {
651
649
AssertParse (
652
650
"""
653
- switch {
654
- 1️⃣case _: return
655
- }2️⃣
651
+ switch 1️⃣ {
652
+ 2️⃣case _: return
653
+ }
656
654
""" ,
657
655
diagnostics: [
658
- // TODO: Old parser expected error on line 1: expected expression in 'switch' statement
659
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " 'case' can only appear inside a 'switch' statement or 'enum' declaration " ) ,
660
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " expected '{}' in 'switch' statement " ) ,
656
+ DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected expression in 'switch' statement " )
661
657
]
662
658
)
663
659
}
664
660
665
661
func testRecovery49( ) {
666
662
AssertParse (
667
663
"""
668
- switch {
669
- 1️⃣case Int: return
670
- 2️⃣case _: return
671
- }3️⃣
664
+ switch 1️⃣ {
665
+ case Int: return
666
+ case _: return
667
+ }
672
668
""" ,
673
669
diagnostics: [
674
- // TODO: Old parser expected error on line 1: expected expression in 'switch' statement
670
+ DiagnosticSpec ( locationMarker : " 1️⃣ " , message : " expected expression in 'switch' statement " ) ,
675
671
// TODO: Old parser expected error on line 2: 'is' keyword required to pattern match against type name, Fix-It replacements: 10 - 10 = 'is '
676
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " 'case' can only appear inside a 'switch' statement or 'enum' declaration " ) ,
677
672
DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " 'case' can only appear inside a 'switch' statement or 'enum' declaration " ) ,
678
- DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " expected '{}' in 'switch' statement" ) ,
673
+ DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " 'case' can only appear inside a 'switch' statement or 'enum' declaration " ) ,
679
674
]
680
675
)
681
676
}
682
677
683
678
func testRecovery50( ) {
684
679
AssertParse (
685
680
"""
686
- switch { 42 } {
681
+ switch 1️⃣ { 42 } {
687
682
case _: return
688
683
}
689
- """
684
+ """ ,
685
+ diagnostics: [
686
+ DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected expression in 'switch' statement " )
687
+ ]
690
688
)
691
689
}
692
690
693
691
func testRecovery51( ) {
694
692
AssertParse (
695
693
"""
696
- switch { 42 }() {
694
+ switch 1️⃣ { 42 }() {
697
695
case _: return
698
696
}
699
- """
697
+ """ ,
698
+ diagnostics: [
699
+ DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " expected expression in 'switch' statement " )
700
+ ]
700
701
)
701
702
}
702
703
0 commit comments