Skip to content

Commit 9c88948

Browse files
committed
Update testcases & Remove TODOs
1 parent 86dd041 commit 9c88948

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

Tests/SwiftParserTest/translated/InitDeinitTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ final class InitDeinitTests: XCTestCase {
8383
AssertParse(
8484
"""
8585
struct FooStructConstructorD {
86-
init() -> FooStructConstructorD { }
86+
init() 1️⃣-> FooStructConstructorD { }
8787
}
8888
""",
8989
diagnostics: [
90-
// TODO: Old parser expected error on line 2: initializers cannot have a result type
90+
DiagnosticSpec(message: "initializers cannot have a result type")
9191
]
9292
)
9393
}

Tests/SwiftParserTest/translated/RecoveryTests.swift

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,7 +1741,7 @@ final class RecoveryTests: XCTestCase {
17411741
DiagnosticSpec(locationMarker: "1️⃣", message: "expected '>' to end generic parameter clause"),
17421742
DiagnosticSpec(locationMarker: "2️⃣", message: "expected type and ')' to end parameter clause"),
17431743
DiagnosticSpec(locationMarker: "3️⃣", message: "unexpected code ')}' before struct"),
1744-
DiagnosticSpec(locationMarker: "4️⃣", message: "unexpected code 'x' before parameter clause"),
1744+
DiagnosticSpec(locationMarker: "4️⃣", message: "initializers cannot have a name", fixIts: ["remove 'x'"]),
17451745
]
17461746
)
17471747
}
@@ -1752,9 +1752,11 @@ final class RecoveryTests: XCTestCase {
17521752
init 1️⃣a(b: Int) {}
17531753
""",
17541754
diagnostics: [
1755-
// TODO: (good first issue) Old parser expected error on line 3: initializers cannot have a name, Fix-It replacements: 8 - 9 = ''
1756-
DiagnosticSpec(message: "unexpected code 'a' before parameter clause")
1757-
]
1755+
DiagnosticSpec(message: "initializers cannot have a name", fixIts: ["remove 'a'"])
1756+
],
1757+
fixedSource: """
1758+
init (b: Int) {}
1759+
"""
17581760
)
17591761
}
17601762

@@ -1764,9 +1766,11 @@ final class RecoveryTests: XCTestCase {
17641766
init? 1️⃣c(_ d: Int) {}
17651767
""",
17661768
diagnostics: [
1767-
// TODO: (good first issue) Old parser expected error on line 1: initializers cannot have a name, Fix-It replacements: 9 - 10 = ''
1768-
DiagnosticSpec(message: "unexpected code 'c' before parameter clause")
1769-
]
1769+
DiagnosticSpec(message: "initializers cannot have a name", fixIts: ["remove 'c'"])
1770+
],
1771+
fixedSource: """
1772+
init? (_ d: Int) {}
1773+
"""
17701774
)
17711775
}
17721776

@@ -1776,9 +1780,11 @@ final class RecoveryTests: XCTestCase {
17761780
init 1️⃣e<T>(f: T) {}
17771781
""",
17781782
diagnostics: [
1779-
// TODO: (good first issue) Old parser expected error on line 1: initializers cannot have a name, Fix-It replacements: 8 - 9 = ''
1780-
DiagnosticSpec(message: "unexpected code 'e<T>' before parameter clause")
1781-
]
1783+
DiagnosticSpec(message: "initializers cannot have a name", fixIts: ["remove 'e<T>'"])
1784+
],
1785+
fixedSource: """
1786+
init (f: T) {}
1787+
"""
17821788
)
17831789
}
17841790

@@ -1788,9 +1794,11 @@ final class RecoveryTests: XCTestCase {
17881794
init? 1️⃣g<T>(_: T) {}
17891795
""",
17901796
diagnostics: [
1791-
// TODO: (good first issue) Old parser expected error on line 1: initializers cannot have a name, Fix-It replacements: 9 - 10 = ''
1792-
DiagnosticSpec(message: "unexpected code 'g<T>' before parameter clause")
1793-
]
1797+
DiagnosticSpec(message: "initializers cannot have a name", fixIts: ["remove 'g<T>'"])
1798+
],
1799+
fixedSource: """
1800+
init? (_: T) {}
1801+
"""
17941802
)
17951803
}
17961804

0 commit comments

Comments
 (0)