Skip to content

Commit 8674724

Browse files
Merge pull request #60812 from AnthonyLatsis/migrate-test-suite-to-gh-issues-12
Gardening: Migrate test suite to GH issues p. 12
2 parents 5b245b4 + 6c615c8 commit 8674724

13 files changed

+138
-121
lines changed

test/Demangle/rdar-82252704.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// rdar://82252704 - [SR-15070]: Declaring a class inside a async throws
2-
// function crashes compiler
1+
// rdar://82252704
2+
// https://github.com/apple/swift/issues/57396
3+
// Declaring a class inside a 'async throws' function crashes compiler
34

45
// RUN: %empty-directory(%t)
56
// RUN: %target-swift-frontend -c %s -o %t/test.o

test/Driver/bad_tmpdir.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
//
77
// REQUIRES: OS=macosx
88

9-
// SR-12362: This test is failing on next branch.
9+
// (https://github.com/apple/swift/issues/54796) This test is failing on
10+
// next branch.
1011
// XFAIL: *
1112

1213
// RUN: env TMP="%t/fake/" TMPDIR="%t/fake/" not %target-build-swift -c -driver-filelist-threshold=0 %s 2>&1 | %FileCheck -check-prefix=CHECK-SOURCES %s

test/Driver/vfs.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
// Verifies that the driver passes the -vfsoverlay flag to the frontend (SR-12834).
1+
// https://github.com/apple/swift/issues/55280
2+
3+
// Verifies that the driver passes the -vfsoverlay flag to the frontend.
24
// RUN: %swiftc_driver -driver-print-jobs -c -vfsoverlay overlay.yaml %s | %FileCheck --check-prefix=CHECK-ONE %s
35

46
// CHECK-ONE: bin{{/|\\\\}}swift{{(-frontend|c)?(\.exe)?"?}} -frontend{{.*}}-c{{.*}}-vfsoverlay overlay.yaml

test/expr/cast/as_coerce.swift

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -113,40 +113,45 @@ let s : AnyObject = C3()
113113
s as C3 // expected-error{{'AnyObject' is not convertible to 'C3'}}
114114
// expected-note@-1{{did you mean to use 'as!' to force downcast?}} {{3-5=as!}}
115115

116-
// SR-6022
117-
func sr6022() -> Any { return 0 }
118-
func sr6022_1() { return; }
119-
protocol SR6022_P {}
120-
121-
_ = sr6022 is SR6022_P // expected-warning {{cast from '() -> Any' to unrelated type 'any SR6022_P' always fails}} // expected-note {{did you mean to call 'sr6022' with '()'?}}{{11-11=()}}
122-
_ = sr6022 as! SR6022_P // expected-warning {{cast from '() -> Any' to unrelated type 'any SR6022_P' always fails}} // expected-note {{did you mean to call 'sr6022' with '()'?}}{{11-11=()}}
123-
_ = sr6022 as? SR6022_P // expected-warning {{cast from '() -> Any' to unrelated type 'any SR6022_P' always fails}} // expected-note {{did you mean to call 'sr6022' with '()'}}{{11-11=()}}
124-
_ = sr6022_1 is SR6022_P // expected-warning {{cast from '() -> ()' to unrelated type 'any SR6022_P' always fails}}
125-
_ = sr6022_1 as! SR6022_P // expected-warning {{cast from '() -> ()' to unrelated type 'any SR6022_P' always fails}}
126-
_ = sr6022_1 as? SR6022_P // expected-warning {{cast from '() -> ()' to unrelated type 'any SR6022_P' always fails}}
127-
128-
func testSR6022_P<T: SR6022_P>(_: T.Type) {
129-
_ = sr6022 is T // expected-warning {{cast from '() -> Any' to unrelated type 'T' always fails}} // expected-note {{did you mean to call 'sr6022' with '()'?}}{{13-13=()}}
130-
_ = sr6022 as! T // expected-warning {{cast from '() -> Any' to unrelated type 'T' always fails}} // expected-note {{did you mean to call 'sr6022' with '()'?}}{{13-13=()}}
131-
_ = sr6022 as? T // expected-warning {{cast from '() -> Any' to unrelated type 'T' always fails}} // expected-note {{did you mean to call 'sr6022' with '()'?}}{{13-13=()}}
132-
_ = sr6022_1 is T // expected-warning {{cast from '() -> ()' to unrelated type 'T' always fails}}
133-
_ = sr6022_1 as! T // expected-warning {{cast from '() -> ()' to unrelated type 'T' always fails}}
134-
_ = sr6022_1 as? T // expected-warning {{cast from '() -> ()' to unrelated type 'T' always fails}}
116+
// https://github.com/apple/swift/issues/48579
117+
118+
protocol P_48579 {}
119+
do {
120+
func f1() -> Any {}
121+
func f2() {}
122+
123+
_ = f1 is P_48579 // expected-warning {{cast from '() -> Any' to unrelated type 'any P_48579' always fails}} // expected-note {{did you mean to call 'f1' with '()'?}}{{9-9=()}}
124+
_ = f1 as! P_48579 // expected-warning {{cast from '() -> Any' to unrelated type 'any P_48579' always fails}} // expected-note {{did you mean to call 'f1' with '()'?}}{{9-9=()}}
125+
_ = f1 as? P_48579 // expected-warning {{cast from '() -> Any' to unrelated type 'any P_48579' always fails}} // expected-note {{did you mean to call 'f1' with '()'}}{{9-9=()}}
126+
_ = f2 is P_48579 // expected-warning {{cast from '() -> ()' to unrelated type 'any P_48579' always fails}}
127+
_ = f2 as! P_48579 // expected-warning {{cast from '() -> ()' to unrelated type 'any P_48579' always fails}}
128+
_ = f2 as? P_48579 // expected-warning {{cast from '() -> ()' to unrelated type 'any P_48579' always fails}}
129+
130+
_ = f1 as! AnyObject // expected-warning {{forced cast from '() -> Any' to 'AnyObject' always succeeds; did you mean to use 'as'?}}
131+
_ = f1 as? AnyObject // expected-warning {{conditional cast from '() -> Any' to 'AnyObject' always succeeds}}
132+
_ = f2 as! Any // expected-warning {{forced cast from '() -> ()' to 'Any' always succeeds; did you mean to use 'as'?}}
133+
_ = f2 as? Any // expected-warning {{conditional cast from '() -> ()' to 'Any' always succeeds}}
134+
135+
136+
func test1<T: P_48579>(_: T.Type) {
137+
_ = f1 is T // expected-warning {{cast from '() -> Any' to unrelated type 'T' always fails}} // expected-note {{did you mean to call 'f1' with '()'?}}{{11-11=()}}
138+
_ = f1 as! T // expected-warning {{cast from '() -> Any' to unrelated type 'T' always fails}} // expected-note {{did you mean to call 'f1' with '()'?}}{{11-11=()}}
139+
_ = f1 as? T // expected-warning {{cast from '() -> Any' to unrelated type 'T' always fails}} // expected-note {{did you mean to call 'f1' with '()'?}}{{11-11=()}}
140+
_ = f2 is T // expected-warning {{cast from '() -> ()' to unrelated type 'T' always fails}}
141+
_ = f2 as! T // expected-warning {{cast from '() -> ()' to unrelated type 'T' always fails}}
142+
_ = f2 as? T // expected-warning {{cast from '() -> ()' to unrelated type 'T' always fails}}
143+
}
144+
145+
func test2<U>(_: U.Type) {
146+
_ = f1 as! U // Okay
147+
_ = f1 as? U // Okay
148+
_ = f2 as! U // Okay
149+
_ = f2 as? U // Okay
150+
}
135151
}
136152

137-
func testSR6022_P_1<U>(_: U.Type) {
138-
_ = sr6022 as! U // Okay
139-
_ = sr6022 as? U // Okay
140-
_ = sr6022_1 as! U // Okay
141-
_ = sr6022_1 as? U // Okay
142-
}
143-
144-
_ = sr6022 as! AnyObject // expected-warning {{forced cast from '() -> Any' to 'AnyObject' always succeeds; did you mean to use 'as'?}}
145-
_ = sr6022 as? AnyObject // expected-warning {{conditional cast from '() -> Any' to 'AnyObject' always succeeds}}
146-
_ = sr6022_1 as! Any // expected-warning {{forced cast from '() -> ()' to 'Any' always succeeds; did you mean to use 'as'?}}
147-
_ = sr6022_1 as? Any // expected-warning {{conditional cast from '() -> ()' to 'Any' always succeeds}}
153+
// https://github.com/apple/swift/issues/56297
148154

149-
// SR-13899
150155
let any: Any = 1
151156
if let int = any as Int { // expected-error {{'Any' is not convertible to 'Int'}}
152157
// expected-note@-1 {{did you mean to use 'as?' to conditionally downcast?}} {{18-20=as?}}

test/expr/cast/metatype_casts.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@ use(C.self as P.Type) // expected-error{{cannot convert value of type 'C.Type' t
5050
use(E.self as P.Protocol) // expected-error{{cannot convert value of type 'E.Type' to type '(any P).Type' in coercion}}
5151
use(E.self as P.Type)
5252

53-
// SR-12946
54-
func SR12946<T>(_ e: T) {
55-
_ = AnyObject.self is T.Type // OK
56-
}
53+
// https://github.com/apple/swift/issues/55392
54+
do {
55+
func f<T>(_ e: T) {
56+
_ = AnyObject.self is T.Type // OK
57+
}
5758

58-
SR12946(1 as AnyObject)
59+
f(1 as AnyObject)
60+
}

test/expr/cast/optional.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func implicitCastOfLiteralToOptional() {
4242
}
4343

4444
// A nil value can be cast to any other optional type.
45-
// https://bugs.swift.org/browse/SR-3505
45+
// https://github.com/apple/swift/issues/46093
4646
func castUnrelatedOptionalTypes(x: Int?) {
4747
let _ = x as String? // expected-error {{cannot convert value}}
4848
let _ = x as? String? // no-warning

test/expr/closure/closures.swift

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -513,26 +513,24 @@ let closure = {
513513
return helper
514514
}
515515

516-
// SR-9839
517-
func SR9839(_ x: @escaping @convention(block) () -> Void) {}
516+
// https://github.com/apple/swift/issues/52253
517+
do {
518+
func f(_: @escaping @convention(block) () -> Void) {}
518519

519-
func id<T>(_ x: T) -> T {
520-
return x
521-
}
520+
func id<T>(_: T) -> T {}
522521

523-
var qux: () -> Void = {}
522+
let qux: () -> Void
524523

525-
SR9839(qux)
526-
SR9839(id(qux)) // expected-error {{conflicting arguments to generic parameter 'T' ('() -> Void' vs. '@convention(block) () -> Void')}}
524+
f(qux)
525+
f(id(qux)) // expected-error {{conflicting arguments to generic parameter 'T' ('() -> Void' vs. '@convention(block) () -> Void')}}
527526

528-
func forceUnwrap<T>(_ x: T?) -> T {
529-
return x!
530-
}
527+
func forceUnwrap<T>(_: T?) -> T {}
531528

532-
var qux1: (() -> Void)? = {}
529+
let qux1: (() -> Void)?
533530

534-
SR9839(qux1!)
535-
SR9839(forceUnwrap(qux1))
531+
f(qux1!)
532+
f(forceUnwrap(qux1))
533+
}
536534

537535
// rdar://problem/65155671 - crash referencing parameter of outer closure
538536
func rdar65155671(x: Int) {
@@ -541,21 +539,22 @@ func rdar65155671(x: Int) {
541539
}(x)
542540
}
543541

544-
func sr3186<T, U>(_ f: (@escaping (@escaping (T) -> U) -> ((T) -> U))) -> ((T) -> U) {
545-
return { x in return f(sr3186(f))(x) }
546-
}
542+
// https://github.com/apple/swift/issues/45774
543+
do {
544+
func f<T, U>(_: (@escaping (@escaping (T) -> U) -> ((T) -> U))) -> ((T) -> U) {}
547545

548-
class SR3186 {
549-
init() {
550-
// expected-warning@+1{{capture 'self' was never used}}
551-
let v = sr3186 { f in { [unowned self, f] x in x != 1000 ? f(x + 1) : "success" } }(0)
552-
print("\(v)")
546+
class C {
547+
init() {
548+
// expected-warning@+1{{capture 'self' was never used}}
549+
let _ = f { fn in { [unowned self, fn] x in x != 1000 ? fn(x + 1) : "success" } }(0)
550+
}
553551
}
554552
}
555553

554+
// https://github.com/apple/swift/issues/56501
556555
// Apply the explicit 'self' rule even if it refers to a capture, if
557-
// we're inside a nested closure
558-
class SR14120 {
556+
// we're inside a nested closure.
557+
class C_56501 {
559558
func operation() {}
560559

561560
func test1() {
@@ -613,24 +612,25 @@ class SR14120 {
613612
}
614613
}
615614

616-
// SR-14678
617-
func call<T>(_ : Int, _ f: () -> (T, Int)) -> (T, Int) {
618-
f()
619-
}
615+
// https://github.com/apple/swift/issues/57029
616+
do {
617+
func call<T>(_ : Int, _ f: () -> (T, Int)) -> (T, Int) {}
620618

621-
func testSR14678() -> (Int, Int) {
622-
call(1) { // expected-error {{cannot convert return expression of type '((), Int)' to return type '(Int, Int)'}}
623-
(print("hello"), 0)
619+
func f() -> (Int, Int) {
620+
call(1) { // expected-error {{cannot convert return expression of type '((), Int)' to return type '(Int, Int)'}}
621+
((), 0)
622+
}
624623
}
625-
}
626624

627-
func testSR14678_Optional() -> (Int, Int)? {
628-
call(1) { // expected-error {{cannot convert return expression of type '((), Int)' to return type '(Int, Int)'}}
629-
(print("hello"), 0)
625+
func f_Optional() -> (Int, Int)? {
626+
call(1) { // expected-error {{cannot convert return expression of type '((), Int)' to return type '(Int, Int)'}}
627+
((), 0)
628+
}
630629
}
631630
}
632631

633-
// SR-13239
632+
// https://github.com/apple/swift/issues/55680
633+
634634
func callit<T>(_ f: () -> T) -> T {
635635
f()
636636
}
@@ -655,61 +655,61 @@ func callitVariadic<T>(_ fs: () -> T...) -> T {
655655
fs.first!()
656656
}
657657

658-
func testSR13239_Tuple() -> Int {
658+
func test_55680_Tuple() -> Int {
659659
// expected-error@+2{{conflicting arguments to generic parameter 'T' ('()' vs. 'Int')}}
660660
// expected-note@+1:3{{generic parameter 'T' inferred as 'Int' from context}}
661661
callitTuple(1) { // expected-note@:18{{generic parameter 'T' inferred as '()' from closure return expression}}
662662
(print("hello"), 0)
663663
}
664664
}
665665

666-
func testSR13239() -> Int {
666+
func test_55680() -> Int {
667667
// expected-error@+2{{conflicting arguments to generic parameter 'T' ('()' vs. 'Int')}}
668668
// expected-note@+1:3{{generic parameter 'T' inferred as 'Int' from context}}
669669
callit { // expected-note@:10{{generic parameter 'T' inferred as '()' from closure return expression}}
670670
print("hello")
671671
}
672672
}
673673

674-
func testSR13239_Args() -> Int {
674+
func test_55680_Args() -> Int {
675675
// expected-error@+2{{conflicting arguments to generic parameter 'T' ('()' vs. 'Int')}}
676676
// expected-note@+1:3{{generic parameter 'T' inferred as 'Int' from context}}
677677
callitArgs(1) { // expected-note@:17{{generic parameter 'T' inferred as '()' from closure return expression}}
678678
print("hello")
679679
}
680680
}
681681

682-
func testSR13239_ArgsFn() -> Int {
682+
func test_55680_ArgsFn() -> Int {
683683
// expected-error@+2{{conflicting arguments to generic parameter 'T' ('()' vs. 'Int')}}
684684
// expected-note@+1:3{{generic parameter 'T' inferred as 'Int' from context}}
685685
callitArgsFn(1) { // expected-note@:19{{generic parameter 'T' inferred as '()' from closure return expression}}
686686
{ print("hello") }
687687
}
688688
}
689689

690-
func testSR13239MultiExpr() -> Int {
690+
func test_55680_MultiExpr() -> Int {
691691
callit {
692692
print("hello")
693693
return print("hello") // expected-error {{cannot convert return expression of type '()' to return type 'Int'}}
694694
}
695695
}
696696

697-
func testSR13239_GenericArg() -> Int {
697+
func test_55680_GenericArg() -> Int {
698698
// Generic argument is inferred as Int from first argument literal, so no conflict in this case.
699699
callitGenericArg(1) {
700700
print("hello") // expected-error {{cannot convert value of type '()' to closure result type 'Int'}}
701701
}
702702
}
703703

704-
func testSR13239_Variadic() -> Int {
704+
func test_55680_Variadic() -> Int {
705705
// expected-error@+2{{conflicting arguments to generic parameter 'T' ('()' vs. 'Int')}}
706706
// expected-note@+1:3{{generic parameter 'T' inferred as 'Int' from context}}
707707
callitVariadic({ // expected-note@:18{{generic parameter 'T' inferred as '()' from closure return expression}}
708708
print("hello")
709709
})
710710
}
711711

712-
func testSR13239_Variadic_Twos() -> Int {
712+
func test_55680_Variadic_Twos() -> Int {
713713
// expected-error@+1{{cannot convert return expression of type '()' to return type 'Int'}}
714714
callitVariadic({
715715
print("hello")

test/expr/closure/closures_swift6.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ class ExplicitSelfRequiredTest {
1212
}
1313
}
1414

15-
class SR14120 {
15+
// https://github.com/apple/swift/issues/56501
16+
class C_56501 {
1617
func operation() {}
1718

1819
func test1() {

test/expr/closure/inference.swift

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,43 +38,42 @@ var nestedClosuresWithBrokenInference = { f: Int in {} }
3838
// expected-error@-2 {{expected expression}}
3939
// expected-error@-3 {{cannot find 'f' in scope}}
4040

41-
// SR-11540
42-
43-
func SR11540<R>(action: () -> R) -> Void {}
44-
45-
func SR11540<T, R>(action: (T) -> R) -> Void {}
41+
// https://github.com/apple/swift/issues/53941
42+
do {
43+
func f1<R>(action: () -> R) -> Void {}
4644

47-
func SR11540_1<T, R>(action: (T) -> R) -> Void {}
45+
func f1<T, R>(action: (T) -> R) -> Void {}
4846

49-
SR11540(action: { return }) // Ok SR11540<R>(action: () -> R) was the selected overload.
47+
func f2<T, R>(action: (T) -> R) -> Void {}
5048

51-
// In case that's the only possible overload, it's acceptable
52-
SR11540_1(action: { return }) // OK
49+
f1(action: { return }) // Ok f1<R>(action: () -> R) was the selected overload.
5350

54-
// SR-8563
55-
func SR8563<A,Z>(_ f: @escaping (A) -> Z) -> (A) -> Z {
56-
return f
51+
// In case that's the only possible overload, it's acceptable
52+
f2(action: { return }) // OK
5753
}
5854

59-
func SR8563<A,B,Z>(_ f: @escaping (A, B) -> Z) -> (A, B) -> Z {
60-
return f
61-
}
55+
// https://github.com/apple/swift/issues/51081
56+
do {
57+
func f1<A,Z>(_ f: @escaping (A) -> Z) -> (A) -> Z {}
58+
59+
func f1<A,B,Z>(_ f: @escaping (A, B) -> Z) -> (A, B) -> Z {}
6260

63-
let aa = SR8563 { (a: Int) in }
64-
let bb = SR8563 { (a1: Int, a2: String) in } // expected-note {{'bb' declared here}}
61+
let aa = f1 { (a: Int) in }
62+
let bb = f1 { (a1: Int, a2: String) in } // expected-note {{'bb' declared here}}
6563

66-
aa(1) // Ok
67-
bb(1, "2") // Ok
68-
bb(1) // expected-error {{missing argument for parameter #2 in call}}
64+
aa(1) // Ok
65+
bb(1, "2") // Ok
66+
bb(1) // expected-error {{missing argument for parameter #2 in call}}
6967

70-
// Tuple
71-
let cc = SR8563 { (_: (Int)) in }
68+
// Tuple
69+
let cc = f1 { (_: (Int)) in }
7270

73-
cc((1)) // Ok
74-
cc(1) // Ok
71+
cc((1)) // Ok
72+
cc(1) // Ok
73+
}
7574

76-
// SR-12955
77-
func SR12955() {
75+
// https://github.com/apple/swift/issues/55401
76+
do {
7877
let f: @convention(c) (T) -> Void // expected-error {{cannot find type 'T' in scope}}
7978
}
8079

test/expr/closure/single_expr.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ let backupPlan: () -> Int = { haltAndCatchFire() }
100100
func missionCritical(storage: () -> String) {}
101101
missionCritical(storage: { haltAndCatchFire() })
102102

103-
// <https://bugs.swift.org/browse/SR-4963>
103+
// https://github.com/apple/swift/issues/47540
104104
enum E { }
105105
func takesAnotherUninhabitedType(e: () -> E) {}
106106
takesAnotherUninhabitedType { haltAndCatchFire() }

0 commit comments

Comments
 (0)