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
Copy file name to clipboardExpand all lines: Tests/SwiftParserTest/translated/RecoveryTests.swift
+45-7Lines changed: 45 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -806,19 +806,39 @@ final class RecoveryTests: XCTestCase {
806
806
assertParse(
807
807
#"""
808
808
struct SS 1️⃣SS : Multi {
809
-
private var a 2️⃣b 3️⃣: Int = ""
809
+
private var a 2️⃣b : Int = ""
810
810
func f() {
811
-
var c 4️⃣d = 5
811
+
var c 3️⃣d = 5
812
812
let _ = 0
813
813
}
814
814
}
815
815
"""#,
816
816
diagnostics:[
817
-
DiagnosticSpec(locationMarker:"1️⃣", message:"found an unexpected second identifier in struct; is there an accidental break?", fixIts:["join the identifiers together"]),
818
-
DiagnosticSpec(locationMarker:"2️⃣", message:"expected ':' in type annotation"),
819
-
DiagnosticSpec(locationMarker:"3️⃣", message:#"unexpected code ': Int = ""' before function"#),
820
-
DiagnosticSpec(locationMarker:"4️⃣", message:"expected ':' in type annotation"),
821
-
]
817
+
DiagnosticSpec(
818
+
locationMarker:"1️⃣",
819
+
message:"found an unexpected second identifier in struct; is there an accidental break?",
820
+
fixIts:["join the identifiers together"]
821
+
),
822
+
DiagnosticSpec(
823
+
locationMarker:"2️⃣",
824
+
message:"found an unexpected second identifier in pattern; is there an accidental break?",
825
+
fixIts:["join the identifiers together","join the identifiers together with camel-case"]
826
+
),
827
+
DiagnosticSpec(
828
+
locationMarker:"3️⃣",
829
+
message:"expected ':' in type annotation",
830
+
fixIts:["insert ':'"]
831
+
),
832
+
],
833
+
fixedSource:#"""
834
+
struct SSSS : Multi {
835
+
private var ab : Int = ""
836
+
func f() {
837
+
var c: d = 5
838
+
let _ = 0
839
+
}
840
+
}
841
+
"""#
822
842
)
823
843
}
824
844
@@ -850,6 +870,24 @@ final class RecoveryTests: XCTestCase {
850
870
)
851
871
}
852
872
873
+
func testRecovery64c(){
874
+
assertParse(
875
+
"""
876
+
private var a 1️⃣b : Int = ""
877
+
""",
878
+
diagnostics:[
879
+
DiagnosticSpec(
880
+
locationMarker:"1️⃣",
881
+
message:"found an unexpected second identifier in pattern; is there an accidental break?",
882
+
fixIts:["join the identifiers together","join the identifiers together with camel-case"]
0 commit comments