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
#line:("join the identifiers together","protocol Multiident {}"),
747
+
#line:("join the identifiers together with camel-case","protocol MultiIdent {}"),
748
+
]
749
+
750
+
for(line, testCase)in testCases {
751
+
assertParse(
752
+
"""
753
+
protocol Multi 1️⃣ident {}
754
+
""",
755
+
diagnostics:[
756
+
DiagnosticSpec(
757
+
message:"found an unexpected second identifier in protocol; is there an accidental break?",
758
+
highlight:"ident",
759
+
fixIts:["join the identifiers together","join the identifiers together with camel-case"],
760
+
line: line
761
+
)
762
+
],
763
+
applyFixIts:[testCase.fixIt],
764
+
fixedSource: testCase.fixedSource,
765
+
line: line
766
+
)
767
+
}
768
+
753
769
}
754
770
755
771
func testRecovery60(){
@@ -758,7 +774,11 @@ final class RecoveryTests: XCTestCase {
758
774
class CCC 1️⃣CCC<T> {}
759
775
""",
760
776
diagnostics:[
761
-
DiagnosticSpec(message:"found an unexpected second identifier in class")
777
+
DiagnosticSpec(
778
+
message:"found an unexpected second identifier in class; is there an accidental break?",
779
+
highlight:"CCC<T>",
780
+
fixIts:["join the identifiers together"]
781
+
)
762
782
],
763
783
fixedSource:"""
764
784
class CCCCCC<T> {}
@@ -775,7 +795,7 @@ final class RecoveryTests: XCTestCase {
775
795
}
776
796
""",
777
797
diagnostics:[
778
-
DiagnosticSpec(locationMarker:"1️⃣", message:"found an unexpected second identifier in enum"),
798
+
DiagnosticSpec(locationMarker:"1️⃣", message:"found an unexpected second identifier in enum; is there an accidental break?", fixIts:["join the identifiers together"]),
779
799
DiagnosticSpec(locationMarker:"2️⃣", message:"consecutive declarations on a line must be separated by ';'"),
780
800
DiagnosticSpec(locationMarker:"3️⃣", message:"unexpected code 'a' before enum case"),
781
801
]
@@ -794,24 +814,39 @@ final class RecoveryTests: XCTestCase {
794
814
}
795
815
"""#,
796
816
diagnostics:[
797
-
DiagnosticSpec(locationMarker:"1️⃣", message:"found an unexpected second identifier in struct"),
817
+
DiagnosticSpec(locationMarker:"1️⃣", message:"found an unexpected second identifier in struct; is there an accidental break?", fixIts:["join the identifiers together"]),
798
818
DiagnosticSpec(locationMarker:"2️⃣", message:"expected ':' in type annotation"),
799
819
DiagnosticSpec(locationMarker:"3️⃣", message:#"unexpected code ': Int = ""' before function"#),
800
-
// TODO: (good first issue) Old parser expected error on line 4: found an unexpected second identifier in variable declaration; is there an accidental break?
801
820
DiagnosticSpec(locationMarker:"4️⃣", message:"expected ':' in type annotation"),
802
821
]
803
822
)
804
823
}
805
824
806
-
functestRecovery64(){
825
+
functestRecovery64a(){
807
826
assertParse(
808
827
"""
809
828
let (efg 1️⃣hij, foobar) = (5, 6)
810
829
""",
811
830
diagnostics:[
812
-
// TODO: (good first issue) Old parser expected error on line 1: found an unexpected second identifier in constant declaration; is there an accidental break?
813
-
DiagnosticSpec(message:"unexpected code 'hij, foobar' in tuple pattern")
814
-
]
831
+
DiagnosticSpec(message:"expected ',' in tuple pattern", fixIts:["insert ','"])
832
+
],
833
+
fixedSource:"""
834
+
let (efg, hij, foobar) = (5, 6)
835
+
"""
836
+
)
837
+
}
838
+
839
+
func testRecovery64b(){
840
+
assertParse(
841
+
"""
842
+
let (efg 1️⃣Hij, foobar) = (5, 6)
843
+
""",
844
+
diagnostics:[
845
+
DiagnosticSpec(message:"expected ':' in tuple pattern", fixIts:["insert ':'"])
0 commit comments