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","var fooBar = 1"),
22
+
#line:("join the identifiers together with camel-case","var fooBar = 1"),
23
+
]
24
+
25
+
for(line, testCase)in testCases {
26
+
27
+
AssertParse(
28
+
"""
29
+
var foo 1️⃣Bar = 1
30
+
""",
31
+
diagnostics:[
32
+
DiagnosticSpec(message:"expected ':' in type annotation"),
33
+
DiagnosticSpec(message:"found an unexpected second identifier in variable; is there an accidental break?", fixIts:["join the identifiers together","join the identifiers together with camel-case"]),
#line:("join the identifiers together","protocol Multiident{}"),
765
+
#line:("join the identifiers together with camel-case","protocol MultiIdent{}"),
766
+
]
767
+
768
+
for(line, testCase)in testCases {
769
+
AssertParse(
770
+
"""
771
+
protocol Multi 1️⃣ident {}
772
+
""",
773
+
diagnostics:[
774
+
DiagnosticSpec(message:"found an unexpected second identifier in protocol; is there an accidental break?", fixIts:["join the identifiers together","join the identifiers together with camel-case"])
775
+
],
776
+
applyFixIts:[testCase.fixIt],
777
+
fixedSource: testCase.fixedSource,
778
+
line: line
779
+
)
780
+
}
771
781
}
772
782
773
783
func testRecovery60(){
@@ -776,7 +786,7 @@ final class RecoveryTests: XCTestCase {
776
786
class CCC 1️⃣CCC<T> {}
777
787
""",
778
788
diagnostics:[
779
-
DiagnosticSpec(message:"found an unexpected second identifier in class")
789
+
DiagnosticSpec(message:"found an unexpected second identifier in class; is there an accidental break?", fixIts:["join the identifiers together","join the identifiers together with camel-case"])
780
790
],
781
791
fixedSource:"""
782
792
class CCCCCC<T> {}
@@ -793,7 +803,7 @@ final class RecoveryTests: XCTestCase {
793
803
}
794
804
""",
795
805
diagnostics:[
796
-
DiagnosticSpec(locationMarker:"1️⃣", message:"found an unexpected second identifier in enum"),
806
+
DiagnosticSpec(locationMarker:"1️⃣", message:"found an unexpected second identifier in enum; is there an accidental break?", fixIts:["join the identifiers together","join the identifiers together with camel-case"]),
797
807
DiagnosticSpec(locationMarker:"2️⃣", message:"consecutive declarations on a line must be separated by ';'"),
798
808
DiagnosticSpec(locationMarker:"3️⃣", message:"unexpected code 'a' before enum case"),
799
809
]
@@ -812,23 +822,25 @@ final class RecoveryTests: XCTestCase {
812
822
}
813
823
"""#,
814
824
diagnostics:[
815
-
DiagnosticSpec(locationMarker:"1️⃣", message:"found an unexpected second identifier in struct"),
825
+
DiagnosticSpec(locationMarker:"1️⃣", message:"found an unexpected second identifier in struct; is there an accidental break?", fixIts:["join the identifiers together"]),
816
826
DiagnosticSpec(locationMarker:"2️⃣", message:"expected ':' in type annotation"),
827
+
DiagnosticSpec(locationMarker:"2️⃣", message:"found an unexpected second identifier in variable; is there an accidental break?", fixIts:["join the identifiers together"]),
817
828
DiagnosticSpec(locationMarker:"3️⃣", message:#"unexpected code ': Int = ""' before function"#),
818
-
// TODO: (good first issue) Old parser expected error on line 4: found an unexpected second identifier in variable declaration; is there an accidental break?
819
829
DiagnosticSpec(locationMarker:"4️⃣", message:"expected ':' in type annotation"),
830
+
DiagnosticSpec(locationMarker:"4️⃣", message:"found an unexpected second identifier in variable; is there an accidental break?", fixIts:["join the identifiers together"]),
820
831
]
821
832
)
822
833
}
823
834
824
835
func testRecovery64(){
836
+
825
837
AssertParse(
826
838
"""
827
839
let (efg 1️⃣hij, foobar) = (5, 6)
828
840
""",
829
841
diagnostics:[
830
-
// TODO: (good first issue) Old parser expected error on line 1: found an unexpected second identifier in constant declaration; is there an accidental break?
831
-
DiagnosticSpec(message:"unexpected code 'hij, foobar' in tuple pattern")
842
+
DiagnosticSpec(message:"expected ',' in tuple pattern"),
843
+
DiagnosticSpec(message:"found an unexpected second identifier in variable; is there an accidental break?", fixIts:["join the identifiers together","join the identifiers together with camel-case"]),
0 commit comments