Skip to content

Commit 9045388

Browse files
Merge pull request #60957 from AnthonyLatsis/migrate-test-suite-to-gh-issues-23
Gardening: Migrate test suite to GH issues p. 23
2 parents ae54953 + c7a3167 commit 9045388

15 files changed

+110
-108
lines changed

test/SymbolGraph/Module/ExportedImport.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
// CHECK-DAG: "precise":"s:1B9StructOneV"
1515

1616
// FIXME: Symbols from `@_exported import` do not get emitted when using swift-symbolgraph-extract
17-
// This is tracked by https://bugs.swift.org/browse/SR-15921.
17+
// This is tracked by https://github.com/apple/swift-docc/issues/179.
1818

1919
// FILES-NOT: [email protected]

test/TypeDecoder/generic_typealias.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ do {
6161
}
6262

6363
do {
64-
// FIXME: https://bugs.swift.org/browse/SR-9762
64+
// FIXME: https://github.com/apple/swift/issues/52190
6565
// let x1: Proto.Alias<String> = 0
6666
// let x2: Proto.OtherAlias<String> = 0
6767

test/TypeRoundTrip/Inputs/testcases/structural_types.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ public func test() {
4949
roundTripType(Array<(@escaping @convention(block) () -> (), @convention(block) () -> ()) -> ()>.Type.self)
5050
#endif
5151

52-
// rdar://81587763: [SR-15025]: Function type syntax doesn't accept variadics
53-
// or __owned
52+
// rdar://81587763
53+
// https://github.com/apple/swift/issues/57353
54+
// Function type syntax doesn't accept variadics or __owned
5455
//
5556
//roundTripType(((__owned String) -> ()).self)
5657
//roundTripType(((__owned String) -> ()).Type.self)

test/stmt/errors.swift

Lines changed: 55 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -174,95 +174,79 @@ func thirteen() {
174174
}
175175
}
176176

177-
// SR 6400
178-
179-
enum SR_6400_E: Error {
180-
case castError
181-
}
177+
// https://github.com/apple/swift/issues/48950
178+
protocol ClassProto: AnyObject {}
179+
do {
180+
enum E: Error {
181+
case castError
182+
}
182183

183-
struct SR_6400_S_1 {}
184-
struct SR_6400_S_2: Error {}
184+
do {
185+
struct S1 {}
186+
struct S2: Error {}
185187

186-
protocol SR_6400_FakeApplicationDelegate: AnyObject {}
187-
class SR_6400_FakeViewController {}
188+
do {
189+
throw E.castError
190+
} catch is S1 {} // expected-warning {{cast from 'any Error' to unrelated type 'S1' always fails}}
188191

189-
func sr_6400() throws {
190-
do {
191-
throw SR_6400_E.castError
192-
} catch is SR_6400_S_1 { // expected-warning {{cast from 'any Error' to unrelated type 'SR_6400_S_1' always fails}}
193-
print("Caught error")
194-
}
195-
196-
do {
197-
throw SR_6400_E.castError
198-
} catch is SR_6400_S_2 {
199-
print("Caught error") // Ok
192+
do {
193+
throw E.castError
194+
} catch is S2 {} // Ok
200195
}
201-
}
202196

203-
func sr_6400_1<T>(error: Error, as type: T.Type) -> Bool {
204-
return (error as? T) != nil // Ok
205-
}
206-
207-
func sr_6400_2(error: Error) {
208-
_ = error as? (SR_6400_FakeViewController & Error) // Ok
209-
}
210-
func sr_6400_3(error: Error) {
211-
_ = error as? (Error & SR_6400_FakeApplicationDelegate) // Ok
212-
}
197+
do {
198+
class C1 {}
199+
class C2: ClassProto & Error {}
213200

214-
class SR_6400_A {}
215-
class SR_6400_B: SR_6400_FakeApplicationDelegate & Error {}
201+
do {
202+
throw E.castError
203+
} catch let error as C1 { // Okay
204+
print(error)
205+
} catch {}
216206

217-
func sr_6400_4() {
218-
do {
219-
throw SR_6400_E.castError
220-
} catch let error as SR_6400_A { // Okay
221-
print(error)
222-
} catch {
223-
print("Bar")
207+
do {
208+
throw E.castError
209+
} catch let error as C2 { // Okay
210+
print(error)
211+
} catch {}
212+
213+
let err: Error
214+
_ = err as? (C1 & Error) // Ok
215+
_ = err as? (Error & ClassProto) // Ok
224216
}
225-
226-
do {
227-
throw SR_6400_E.castError
228-
} catch let error as SR_6400_B { // Okay
229-
print(error)
230-
} catch {
231-
print("Bar")
217+
218+
func f<T>(error: Error, as type: T.Type) -> Bool {
219+
return (error as? T) != nil // Ok
232220
}
233221
}
234222

235-
// SR-11402
223+
// https://github.com/apple/swift/issues/53803
224+
protocol P {}
225+
do {
226+
class Super {}
227+
class Sub: Super, P {}
228+
final class Final {}
236229

237-
protocol SR_11402_P {}
238-
class SR_11402_Superclass {}
239-
class SR_11402_Subclass: SR_11402_Superclass, SR_11402_P {}
230+
let x: any P
240231

241-
func sr_11402_func1(_ x: SR_11402_P) {
242-
if let y = x as? SR_11402_Superclass { // Okay
243-
print(y)
244-
}
245-
}
246-
247-
final class SR_11402_Final {}
232+
if let _ = x as? Super {} // Okay
248233

249-
func sr_11402_func2(_ x: SR_11402_P) {
250-
if let y = x as? SR_11402_Final { // expected-warning {{cast from 'any SR_11402_P' to unrelated type 'SR_11402_Final' always fails}}
251-
print(y)
252-
}
234+
if let _ = x as? Final {} // expected-warning {{cast from 'any P' to unrelated type 'Final' always fails}}
253235
}
254236

255-
// https://bugs.swift.org/browse/SR-13654
237+
// https://github.com/apple/swift/issues/56091
238+
do {
239+
func f() throws -> String {}
256240

257-
func sr_13654_func() throws -> String {}
241+
func invalid_interpolation() {
242+
_ = try "\(f())" // expected-error {{errors thrown from here are not handled}}
243+
_ = "\(try f())" // expected-error {{errors thrown from here are not handled}}
244+
}
258245

259-
func sr_13654_invalid_interpolation() {
260-
_ = try "\(sr_13654_func())" // expected-error {{errors thrown from here are not handled}}
261-
_ = "\(try sr_13654_func())" // expected-error {{errors thrown from here are not handled}}
262-
}
263-
func sr_13654_valid_interpolation() throws {
264-
_ = try "\(sr_13654_func())"
265-
_ = "\(try sr_13654_func())"
246+
func valid_interpolation() throws {
247+
_ = try "\(f())"
248+
_ = "\(try f())"
249+
}
266250
}
267251

268252
// rdar://problem/72748150

test/stmt/foreach.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,12 @@ func testRepeated(ri: RepeatedSequence<Int>) {
227227
for x in ri { _ = x }
228228
}
229229

230-
// SR-12398: Poor pattern matching diagnostic: "for-in loop requires '[Int]' to conform to 'Sequence'"
231-
func sr_12398(arr1: [Int], arr2: [(a: Int, b: String)]) {
230+
// https://github.com/apple/swift/issues/54836
231+
// Poor pattern matching diagnostic: for-in loop requires '[Int]' to conform to 'Sequence'
232+
do {
233+
let arr1: [Int]
234+
let arr2: [(a: Int, b: String)]
235+
232236
for (x, y) in arr1 {}
233237
// expected-error@-1 {{tuple pattern cannot match values of non-tuple type 'Int'}}
234238

@@ -245,7 +249,8 @@ func testForEachWhereWithClosure(_ x: [Int]) {
245249
for i in x where x.contains(where: { $0.byteSwapped == i }) {}
246250
}
247251

248-
// https://github.com/apple/swift/issues/59522 - use of `prefix` with generic base causes ambiguity in for-in statement
252+
// https://github.com/apple/swift/issues/59522
253+
// Use of 'prefix' with generic base causes ambiguity in for-in statement
249254
func test_no_ambiguity_with_prefix_iterator<C: Collection>(c: C) {
250255
for _ in c.prefix(1) { // Ok
251256
}

test/stmt/if_while_var.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ class UsesPayload {
291291
}
292292
}
293293

294-
func sr_13258() {
294+
// https://github.com/apple/swift/issues/55698
295+
do {
295296
let a = 1
296297
let b = Int?.none
297298
if let c = b ?? a { _ = c } // expected-error {{initializer for conditional binding must have Optional type, not 'Int'}}

test/stmt/statements.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ func test_guard(_ x : Int, y : Int??, z: Int?, cond : Bool) {
381381

382382
guard case _ = x else {} // expected-warning {{'guard' condition is always true, body is unreachable}}
383383

384-
// SR-7567
384+
// https://github.com/apple/swift/issues/50109
385385
guard let outer = y else {
386386
// FIXME: Bring back the tailored diagnostic
387387
guard true else {

test/stmt/yield.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ struct YieldInDefer {
9393
}
9494
}
9595

96-
// SR-15066
96+
// https://github.com/apple/swift/issues/57393
9797
struct InvalidYieldParsing {
9898
var property: String {
9999
_read {

test/type/array.swift

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,15 @@ func passAssocType<T : HasAssocType>(_ t: T) {
114114
takesAssocType(t, [T.A](), [T.A?]())
115115
}
116116

117-
// SR-11134
118-
119-
let sr_11134_1 = [[1, 2, 3][0]] // ok
120-
let sr_11134_2 = [[1, 2, 3] [1]] // expected-warning {{unexpected subscript in array literal; did you mean to write two separate elements instead?}}
121-
// expected-note@-1 {{add a separator between the elements}}{{28-28=,}}
122-
// expected-note@-2 {{remove the space between the elements to silence this warning}}{{28-29=}}
123-
let sr_11134_3 = [
124-
[1, 2, 3] [1] // expected-warning {{unexpected subscript in array literal; did you mean to write two separate elements instead?}}
125-
// expected-note@-1 {{add a separator between the elements}}{{12-12=,}}
126-
// expected-note@-2 {{remove the space between the elements to silence this warning}}{{12-13=}}
127-
]
117+
// https://github.com/apple/swift/issues/53530
118+
do {
119+
let _ = [[1, 2, 3][0]] // ok
120+
let _ = [[1, 2, 3] [1]] // expected-warning {{unexpected subscript in array literal; did you mean to write two separate elements instead?}}
121+
// expected-note@-1 {{add a separator between the elements}}{{21-21=,}}
122+
// expected-note@-2 {{remove the space between the elements to silence this warning}}{{21-22=}}
123+
let _ = [
124+
[1, 2, 3] [1] // expected-warning {{unexpected subscript in array literal; did you mean to write two separate elements instead?}}
125+
// expected-note@-1 {{add a separator between the elements}}{{14-14=,}}
126+
// expected-note@-2 {{remove the space between the elements to silence this warning}}{{14-15=}}
127+
]
128+
}

test/type/opaque.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,12 +537,14 @@ func test_diagnostic_with_contextual_generic_params() {
537537
}
538538
}
539539

540-
// SR-10988 - Suggest `return` when the last statement of a multi-statement function body would be a valid return value
540+
// https://github.com/apple/swift/issues/53378
541+
// Suggest `return` when the last statement of a multi-statement function body
542+
// would be a valid return value
541543
protocol P1 {
542544
}
543545
protocol P2 {
544546
}
545-
func sr10988() {
547+
do {
546548
func test() -> some Numeric {
547549
// expected-error@-1 {{function declares an opaque return type, but has no return statements in its body from which to infer an underlying type}}
548550
let x = 0

0 commit comments

Comments
 (0)