Skip to content

Commit 39e9c75

Browse files
authored
Merge pull request #1364 from ahoppen/ahoppen/classify-todos
Remove semantic TODOs from translated SwiftParserTest and classify simple issues as “good first issue”
2 parents 42baa2a + 2e421ec commit 39e9c75

18 files changed

+71
-337
lines changed

Tests/SwiftParserTest/translated/AvailabilityQueryTests.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ final class AvailabilityQueryTests: XCTestCase {
146146
}
147147
""",
148148
diagnostics: [
149-
// TODO: Old parser expected error on line 1: expected version number
150149
DiagnosticSpec(
151150
message: "expected ')' to end availability condition",
152151
notes: [
@@ -162,10 +161,7 @@ final class AvailabilityQueryTests: XCTestCase {
162161
"""
163162
if #available(OSX) {
164163
}
165-
""",
166-
diagnostics: [
167-
// TODO: Old parser expected error on line 1: expected version number
168-
]
164+
"""
169165
)
170166
}
171167

@@ -176,7 +172,6 @@ final class AvailabilityQueryTests: XCTestCase {
176172
}
177173
""",
178174
diagnostics: [
179-
// TODO: Old parser expected error on line 1: expected ')'
180175
DiagnosticSpec(
181176
message: "expected ')' to end availability condition",
182177
notes: [
@@ -353,7 +348,6 @@ final class AvailabilityQueryTests: XCTestCase {
353348
}
354349
""",
355350
diagnostics: [
356-
// TODO: Old parser expected error on line 1: expected version number
357351
DiagnosticSpec(
358352
message: "expected ')' to end availability condition",
359353
notes: [
@@ -413,7 +407,7 @@ final class AvailabilityQueryTests: XCTestCase {
413407
}
414408
""",
415409
diagnostics: [
416-
// TODO: Old parser expected error on line 1: version comparison not needed, Fix-It replacements: 19 - 22 = ''
410+
// TODO: (good first issue) Old parser expected error on line 1: version comparison not needed, Fix-It replacements: 19 - 22 = ''
417411
DiagnosticSpec(message: "unexpected code '>= 10.51, *' in availability condition")
418412
]
419413
)

Tests/SwiftParserTest/translated/AvailabilityQueryUnavailabilityTests.swift

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase {
127127
}
128128
""",
129129
diagnostics: [
130-
// TODO: Old parser expected error on line 1: expected version number
131130
DiagnosticSpec(
132131
message: "expected ')' to end availability condition",
133132
notes: [
@@ -143,10 +142,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase {
143142
"""
144143
if #unavailable(OSX) {
145144
}
146-
""",
147-
diagnostics: [
148-
// TODO: Old parser expected error on line 1: expected version number
149-
]
145+
"""
150146
)
151147
}
152148

@@ -321,7 +317,6 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase {
321317
}
322318
""",
323319
diagnostics: [
324-
// TODO: Old parser expected error on line 1: expected version number
325320
DiagnosticSpec(
326321
message: "expected ')' to end availability condition",
327322
notes: [
@@ -346,10 +341,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase {
346341
"""
347342
if #unavailable(iDishwasherOS 10.51, OSX 10.51) {
348343
}
349-
""",
350-
diagnostics: [
351-
// TODO: Old parser expected warning on line 1: unrecognized platform name 'iDishwasherOS'
352-
]
344+
"""
353345
)
354346
}
355347

@@ -373,7 +365,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase {
373365
}
374366
""",
375367
diagnostics: [
376-
// TODO: Old parser expected error on line 2: version comparison not needed, Fix-It replacements: 21 - 24 = ''
368+
// TODO: (good first issue) Old parser expected error on line 2: version comparison not needed, Fix-It replacements: 21 - 24 = ''
377369
DiagnosticSpec(message: "unexpected code '>= 10.51' in availability condition")
378370
]
379371
)
@@ -424,15 +416,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase {
424416
}
425417
if #available(macOS 10.51, *), case 42 = 42, #unavailable(macOS 10.52) {
426418
}
427-
""",
428-
diagnostics: [
429-
// TODO: Old parser expected error on line 2: #available and #unavailable cannot be in the same statement
430-
// TODO: Old parser expected error on line 4: #available and #unavailable cannot be in the same statement
431-
// TODO: Old parser expected error on line 6: #available and #unavailable cannot be in the same statement
432-
// TODO: Old parser expected error on line 8: #available and #unavailable cannot be in the same statement
433-
// TODO: Old parser expected error on line 10: #available and #unavailable cannot be in the same statement
434-
// TODO: Old parser expected error on line 12: #available and #unavailable cannot be in the same statement
435-
]
419+
"""
436420
)
437421
}
438422

@@ -458,7 +442,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase {
458442
}
459443
""",
460444
diagnostics: [
461-
// TODO: Old parser expected error on line 2: #available cannot be used as an expression, did you mean to use '#unavailable'?, Fix-It replacements: 4 - 14 = '#unavailable', 18 - 27 = ''
445+
// TODO: (good first issue) Old parser expected error on line 2: #available cannot be used as an expression, did you mean to use '#unavailable'?, Fix-It replacements: 4 - 14 = '#unavailable', 18 - 27 = ''
462446
DiagnosticSpec(message: "unexpected code '== false' in 'if' statement")
463447
]
464448
)

Tests/SwiftParserTest/translated/DeprecatedWhereTests.swift

Lines changed: 10 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
import XCTest
1616

17+
// TODO: The generic where clause next to generic parameters is only valid in language mode 4. We should disallow them in language mode 5.
18+
1719
final class DeprecatedWhereTests: XCTestCase {
1820
func testDeprecatedWhere1() {
1921
AssertParse(
@@ -45,10 +47,7 @@ final class DeprecatedWhereTests: XCTestCase {
4547
func f4<T>(x: T) -> Int { return 2 } // no-warning
4648
// 4: Trailing where
4749
func f5<T>(x: T) where T : Equatable {} // no-warning
48-
""",
49-
diagnostics: [
50-
// TODO: Old parser expected error on line 5: 'where' clause next to generic parameters is obsolete, Fix-It replacements: 10 - 30 = '', 37 - 37 = ' where T: Womparable'
51-
]
50+
"""
5251
)
5352
}
5453

@@ -68,12 +67,7 @@ final class DeprecatedWhereTests: XCTestCase {
6867
func f24<T where T: Womparable>(x: T) where T: Equatable {}
6968
// 3,4
7069
func f34<T>(x: T) -> Int where T: Equatable { return 2 } // no-warning
71-
""",
72-
diagnostics: [
73-
// TODO: Old parser expected error on line 3: 'where' clause next to generic parameters is obsolete, Fix-It replacements: 21 - 41 = '', 48 - 48 = ' where T: Womparable'
74-
// TODO: Old parser expected error on line 9: 'where' clause next to generic parameters is obsolete, Fix-It replacements: 11 - 31 = '', 45 - 45 = ' where T: Womparable'
75-
// TODO: Old parser expected error on line 11: 'where' clause next to generic parameters is obsolete, Fix-It replacements: 11 - 31 = '', 39 - 44 = 'where T: Womparable,'
76-
]
70+
"""
7771
)
7872
}
7973

@@ -87,12 +81,7 @@ final class DeprecatedWhereTests: XCTestCase {
8781
func f124<T: Mashable where T: Womparable>(x: T) where T: Equatable {}
8882
// 2,3,4
8983
func f234<T where T: Womparable>(x: T) -> Int where T: Equatable { return 2 }
90-
""",
91-
diagnostics: [
92-
// TODO: Old parser expected error on line 3: 'where' clause next to generic parameters is obsolete, Fix-It replacements: 22 - 42 = '', 56 - 56 = ' where T: Womparable'
93-
// TODO: Old parser expected error on line 5: 'where' clause next to generic parameters is obsolete, Fix-It replacements: 22 - 42 = '', 50 - 55 = 'where T: Womparable,'
94-
// TODO: Old parser expected error on line 7: 'where' clause next to generic parameters is obsolete, Fix-It replacements: 12 - 32 = '', 47 - 52 = 'where T: Womparable,'
95-
]
84+
"""
9685
)
9786
}
9887

@@ -102,10 +91,7 @@ final class DeprecatedWhereTests: XCTestCase {
10291
// FuncDecl: Choose 4
10392
// 1,2,3,4
10493
func f1234<T: Mashable where T: Womparable>(x: T) -> Int where T: Equatable { return 2 }
105-
""",
106-
diagnostics: [
107-
// TODO: Old parser expected error on line 3: 'where' clause next to generic parameters is obsolete, Fix-It replacements: 23 - 43 = '', 58 - 63 = 'where T: Womparable,'
108-
]
94+
"""
10995
)
11096
}
11197

@@ -128,10 +114,7 @@ final class DeprecatedWhereTests: XCTestCase {
128114
struct S2<T where T: Womparable> {}
129115
// 3: Trailing where
130116
struct S3<T> where T : Equatable {} // no-warning
131-
""",
132-
diagnostics: [
133-
// TODO: Old parser expected error on line 5: 'where' clause next to generic parameters is obsolete, Fix-It replacements: 12 - 32 = '', 33 - 33 = ' where T: Womparable'
134-
]
117+
"""
135118
)
136119
}
137120

@@ -145,11 +128,7 @@ final class DeprecatedWhereTests: XCTestCase {
145128
struct S13<T: Mashable> where T: Equatable {} // no-warning
146129
// 2,3
147130
struct S23<T where T: Womparable> where T: Equatable {}
148-
""",
149-
diagnostics: [
150-
// TODO: Old parser expected error on line 3: 'where' clause next to generic parameters is obsolete, Fix-It replacements: 23 - 43 = '', 44 - 44 = ' where T: Womparable'
151-
// TODO: Old parser expected error on line 7: 'where' clause next to generic parameters is obsolete, Fix-It replacements: 13 - 33 = '', 35 - 40 = 'where T: Womparable,'
152-
]
131+
"""
153132
)
154133
}
155134

@@ -159,10 +138,7 @@ final class DeprecatedWhereTests: XCTestCase {
159138
// NominalTypeDecl: Choose 3
160139
// 1,2,3
161140
struct S123<T: Mashable where T: Womparable> where T: Equatable {}
162-
""",
163-
diagnostics: [
164-
// TODO: Old parser expected error on line 3: 'where' clause next to generic parameters is obsolete, Fix-It replacements: 24 - 44 = '', 46 - 51 = 'where T: Womparable,'
165-
]
141+
"""
166142
)
167143
}
168144

@@ -175,11 +151,7 @@ final class DeprecatedWhereTests: XCTestCase {
175151
protocol ProtoD {}
176152
func testCombinedConstraints<T: ProtoA & ProtoB where T: ProtoC>(x: T) {}
177153
func testCombinedConstraints<T: ProtoA & ProtoB where T: ProtoC>(x: T) where T: ProtoD {}
178-
""",
179-
diagnostics: [
180-
// TODO: Old parser expected error on line 5: 'where' clause next to generic parameters is obsolete, Fix-It replacements: 48 - 64 = '', 71 - 71 = ' where T: ProtoC'
181-
// TODO: Old parser expected error on line 6: 'where' clause next to generic parameters is obsolete, Fix-It replacements: 48 - 64 = '', 72 - 77 = 'where T: ProtoC,'
182-
]
154+
"""
183155
)
184156
}
185157

@@ -189,8 +161,6 @@ final class DeprecatedWhereTests: XCTestCase {
189161
func testCombinedConstraintsOld<T: 2️⃣protocol3️⃣<ProtoA, ProtoB> where T: ProtoC4️⃣>(x: T) {}
190162
""",
191163
diagnostics: [
192-
// TODO: Old parser expected error on line 1: 'where' clause next to generic parameters is obsolete, Fix-It replacements: 60 - 76 = '', 83 - 83 = ' where T: ProtoC'
193-
// TODO: Old parser expected error on line 1: 'protocol<...>' composition syntax has been removed
194164
DiagnosticSpec(locationMarker: "2️⃣", message: "expected inherited type in generic parameter"),
195165
DiagnosticSpec(locationMarker: "2️⃣", message: "expected '>' to end generic parameter clause"),
196166
DiagnosticSpec(locationMarker: "2️⃣", message: "expected parameter clause in function signature"),
@@ -206,8 +176,6 @@ final class DeprecatedWhereTests: XCTestCase {
206176
func testCombinedConstraintsOld<T: 2️⃣protocol3️⃣<ProtoA, ProtoB> where T: ProtoC4️⃣>(x: T) where T: ProtoD {}
207177
""",
208178
diagnostics: [
209-
// TODO: Old parser expected error on line 1: 'where' clause next to generic parameters is obsolete, Fix-It replacements: 60 - 76 = '', 84 - 89 = 'where T: ProtoC,'
210-
// TODO: Old parser expected error on line 1: 'protocol<...>' composition syntax has been removed
211179
DiagnosticSpec(locationMarker: "2️⃣", message: "expected inherited type in generic parameter"),
212180
DiagnosticSpec(locationMarker: "2️⃣", message: "expected '>' to end generic parameter clause"),
213181
DiagnosticSpec(locationMarker: "2️⃣", message: "expected parameter clause in function signature"),

Tests/SwiftParserTest/translated/DiagnoseAvailabilityTests.swift

Lines changed: 11 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,7 @@ final class DiagnoseAvailabilityTests: XCTestCase {
4747
"""
4848
@available(OSX 10.0, deprecated: 10.12)
4949
func shorthandFollowedByDeprecated() {}
50-
""",
51-
diagnostics: [
52-
// TODO: Old parser expected error on line 1: 'deprecated' can't be combined with shorthand specification 'OSX 10.0'
53-
// TODO: Old parser expected note on line 1: did you mean to specify an introduction version?, Fix-It replacements: 15 - 15 = ', introduced:'
54-
// TODO: Old parser expected error on line 1: expected declaration
55-
]
50+
"""
5651
)
5752
}
5853

@@ -61,11 +56,7 @@ final class DiagnoseAvailabilityTests: XCTestCase {
6156
"""
6257
@available(OSX 10.0, introduced: 10.12)
6358
func shorthandFollowedByIntroduced() {}
64-
""",
65-
diagnostics: [
66-
// TODO: Old parser expected error on line 1: 'introduced' can't be combined with shorthand specification 'OSX 10.0'
67-
// TODO: Old parser expected error on line 1: expected declaration
68-
]
59+
"""
6960
)
7061
}
7162

@@ -83,11 +74,7 @@ final class DiagnoseAvailabilityTests: XCTestCase {
8374
"""
8475
@available(iOS 6.0, OSX 10.0, deprecated: 10.12)
8576
func twoShorthandsFollowedByDeprecated() {}
86-
""",
87-
diagnostics: [
88-
// TODO: Old parser expected error on line 1: 'deprecated' can't be combined with shorthand specification 'OSX 10.0'
89-
// TODO: Old parser expected error on line 1: expected declaration
90-
]
77+
"""
9178
)
9279
}
9380

@@ -105,10 +92,7 @@ final class DiagnoseAvailabilityTests: XCTestCase {
10592
"""
10693
@available(*, deprecated: 4.2)
10794
func allPlatformsDeprecatedVersion() {}
108-
""",
109-
diagnostics: [
110-
// TODO: Old parser expected warning on line 1: unexpected version number in 'available' attribute for non-specific platform '*', Fix-It replacements: 25 - 30 = ''
111-
]
95+
"""
11296
)
11397
}
11498

@@ -117,10 +101,7 @@ final class DiagnoseAvailabilityTests: XCTestCase {
117101
"""
118102
@available(*, deprecated, obsoleted: 4.2)
119103
func allPlatformsDeprecatedAndObsoleted() {}
120-
""",
121-
diagnostics: [
122-
// TODO: Old parser expected warning on line 1: unexpected version number in 'available' attribute for non-specific platform '*', Fix-It replacements: 36 - 41 = ''
123-
]
104+
"""
124105
)
125106
}
126107

@@ -129,10 +110,7 @@ final class DiagnoseAvailabilityTests: XCTestCase {
129110
"""
130111
@available(*, introduced: 4.0, deprecated: 4.1, obsoleted: 4.2)
131112
func allPlatformsDeprecatedAndObsoleted2() {}
132-
""",
133-
diagnostics: [
134-
// TODO: Old parser expected warning on line 1: unexpected version number in 'available' attribute for non-specific platform '*', Fix-It replacements: 25 - 30 = '', 42 - 47 = '', 58 - 63 = ''
135-
]
113+
"""
136114
)
137115
}
138116

@@ -141,10 +119,7 @@ final class DiagnoseAvailabilityTests: XCTestCase {
141119
"""
142120
@available(swift, unavailable)
143121
func swiftUnavailable() {}
144-
""",
145-
diagnostics: [
146-
// TODO: Old parser expected warning on line 1: 'unavailable' cannot be used in 'available' attribute for platform 'swift'
147-
]
122+
"""
148123
)
149124
}
150125

@@ -153,10 +128,7 @@ final class DiagnoseAvailabilityTests: XCTestCase {
153128
"""
154129
@available(swift, unavailable, introduced: 4.2)
155130
func swiftUnavailableIntroduced() {}
156-
""",
157-
diagnostics: [
158-
// TODO: Old parser expected warning on line 1: 'unavailable' cannot be used in 'available' attribute for platform 'swift'
159-
]
131+
"""
160132
)
161133
}
162134

@@ -165,10 +137,7 @@ final class DiagnoseAvailabilityTests: XCTestCase {
165137
"""
166138
@available(swift, deprecated)
167139
func swiftDeprecated() {}
168-
""",
169-
diagnostics: [
170-
// TODO: Old parser expected warning on line 1: expected version number with 'deprecated' in 'available' attribute for platform 'swift'
171-
]
140+
"""
172141
)
173142
}
174143

@@ -177,10 +146,7 @@ final class DiagnoseAvailabilityTests: XCTestCase {
177146
"""
178147
@available(swift, deprecated, obsoleted: 4.2)
179148
func swiftDeprecatedObsoleted() {}
180-
""",
181-
diagnostics: [
182-
// TODO: Old parser expected warning on line 1: expected version number with 'deprecated' in 'available' attribute for platform 'swift'
183-
]
149+
"""
184150
)
185151
}
186152

@@ -189,10 +155,7 @@ final class DiagnoseAvailabilityTests: XCTestCase {
189155
#"""
190156
@available(swift, message: "missing valid option")
191157
func swiftMessage() {}
192-
"""#,
193-
diagnostics: [
194-
// TODO: Old parser expected warning on line 1: expected 'introduced', 'deprecated', or 'obsoleted' in 'available' attribute for platform 'swift'
195-
]
158+
"""#
196159
)
197160
}
198161

0 commit comments

Comments
 (0)