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-8Lines changed: 45 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -786,20 +786,39 @@ final class RecoveryTests: XCTestCase {
786
786
assertParse(
787
787
#"""
788
788
struct SS 1️⃣SS : Multi {
789
-
private var a 2️⃣b 3️⃣: Int = ""
789
+
private var a 2️⃣b : Int = ""
790
790
func f() {
791
-
var c 4️⃣d = 5
791
+
var c 3️⃣d = 5
792
792
let _ = 0
793
793
}
794
794
}
795
795
"""#,
796
796
diagnostics:[
797
-
DiagnosticSpec(locationMarker:"1️⃣", message:"found an unexpected second identifier in struct"),
798
-
DiagnosticSpec(locationMarker:"2️⃣", message:"expected ':' in type annotation"),
799
-
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
-
DiagnosticSpec(locationMarker:"4️⃣", message:"expected ':' in type annotation"),
802
-
]
797
+
DiagnosticSpec(
798
+
locationMarker:"1️⃣",
799
+
message:"found an unexpected second identifier in struct; is there an accidental break?",
800
+
fixIts:["join the identifiers together"]
801
+
),
802
+
DiagnosticSpec(
803
+
locationMarker:"2️⃣",
804
+
message:"found an unexpected second identifier in pattern; is there an accidental break?",
805
+
fixIts:["join the identifiers together","join the identifiers together with camel-case"]
806
+
),
807
+
DiagnosticSpec(
808
+
locationMarker:"3️⃣",
809
+
message:"expected ':' in type annotation",
810
+
fixIts:["insert ':'"]
811
+
),
812
+
],
813
+
fixedSource:#"""
814
+
struct SSSS : Multi {
815
+
private var ab : Int = ""
816
+
func f() {
817
+
var c: d = 5
818
+
let _ = 0
819
+
}
820
+
}
821
+
"""#
803
822
)
804
823
}
805
824
@@ -815,6 +834,24 @@ final class RecoveryTests: XCTestCase {
815
834
)
816
835
}
817
836
837
+
func testRecovery64c(){
838
+
assertParse(
839
+
"""
840
+
private var a 1️⃣b : Int = ""
841
+
""",
842
+
diagnostics:[
843
+
DiagnosticSpec(
844
+
locationMarker:"1️⃣",
845
+
message:"found an unexpected second identifier in pattern; is there an accidental break?",
846
+
fixIts:["join the identifiers together","join the identifiers together with camel-case"]
0 commit comments