Skip to content

Commit daaac53

Browse files
committed
Gardening: Migrate test suite to GH issues: SILGen (1/2)
1 parent a68b554 commit daaac53

19 files changed

+95
-67
lines changed

test/SILGen/accessors.swift

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,20 @@ func test_rec2(_ outer: inout Rec2Outer) -> Int {
133133
// CHECK: sil hidden [ossa] @$s9accessors9test_rec2ySiAA9Rec2OuterVzF : $@convention(thin) (@inout Rec2Outer) -> Int {
134134
// CHECK: function_ref @$s9accessors9Rec2OuterV5innerAA0B5InnerVvau : $@convention(method) (@inout Rec2Outer) -> UnsafeMutablePointer<Rec2Inner>
135135

136-
// SR-12456: Compiler crash on class var override adding observer.
137-
class SR12456Base {
138-
open class var instance: SR12456Base {
136+
// https://github.com/apple/swift/issues/54895
137+
// Compiler crash on 'class var' override adding observer
138+
139+
class OverrideAddingObserver_Base {
140+
open class var instance: OverrideAddingObserver_Base {
139141
get {
140-
return SR12456Base()
142+
return OverrideAddingObserver_Base()
141143
}
142144
set {}
143145
}
144146
}
145147

146-
class SR12456Subclass : SR12456Base {
147-
override class var instance: SR12456Base {
148+
class OverrideAddingObserver_Derived : OverrideAddingObserver_Base {
149+
override class var instance: OverrideAddingObserver_Base {
148150
didSet {}
149151
}
150152
}

test/SILGen/assignment.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ func copyRightToLeft(p: inout P) {
5050
p.left = p.right
5151
}
5252

53-
// SR-5919
53+
// https://github.com/apple/swift/issues/48478
54+
5455
func stupidGames() -> ((), ()) {
5556
return ((), ())
5657
}

test/SILGen/auto_generated_super_init_call.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,9 @@ class ChildOfParentWithNoDefaultInit : ParentWithNoDefaultInit {
134134
}
135135
}
136136

137-
// <https://bugs.swift.org/browse/SR-5974> - auto-generated super.init()
138-
// delegation to a throwing or failing initializer
137+
// https://github.com/apple/swift/issues/48533
138+
// Auto-generated 'super.init()' delegation to a throwing or failing initializer
139+
139140
class FailingParent {
140141
init?() {}
141142
}

test/SILGen/call_as_function.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ func test_call_as_function<T : C>(_ s: S, _ p1: P1, _ p2: P2, _ t: T) {
2222
// CHECK: switch_enum %{{.+}} : $Optional<Int>
2323
let _: Int = s(0)
2424

25-
// SR-12590: SILGen crash on existential callAsFunction.
25+
// https://github.com/apple/swift/issues/55035
26+
// SILGen crash on existential callAsFunction.
27+
//
2628
// CHECK: witness_method $@opened({{.+}}, any P1) Self, #P1.callAsFunction : <Self where Self : P1> (Self) -> () -> ()
2729
p1()
2830

test/SILGen/capture-transitive.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// RUN: %target-swift-emit-silgen %s | %FileCheck %s
2-
// SR-8398
2+
3+
// https://github.com/apple/swift/issues/50924
4+
35
func fibonacci(_ n: Int) -> Int {
46
var cache: [Int: Int] = [:]
57

test/SILGen/capture_order.swift

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ func captureInClosure() {
119119

120120
/// Regression tests
121121

122-
class SR4812 {
122+
// https://github.com/apple/swift/issues/47389
123+
class С_47389 {
123124
public func foo() {
124125
let bar = { [weak self] in
125126
// expected-error@-1 {{closure captures 'bar' before it is declared}}
@@ -134,19 +135,22 @@ class SR4812 {
134135
}
135136
}
136137

137-
func timeout(_ f: @escaping () -> Void) {
138-
f()
139-
}
140-
141-
func sr10687() {
142-
timeout { // expected-error {{closure captures 'x' before it is declared}}
143-
proc()
138+
// https://github.com/apple/swift/issues/53085
139+
do {
140+
func timeout(_ f: @escaping () -> Void) {
141+
f()
144142
}
145-
146-
let x = 0 // expected-note {{captured value declared here}}
147-
148-
func proc() {
149-
_ = x // expected-note {{captured here}}
143+
144+
func f() {
145+
timeout { // expected-error {{closure captures 'x' before it is declared}}
146+
proc()
147+
}
148+
149+
let x = 0 // expected-note {{captured value declared here}}
150+
151+
func proc() {
152+
_ = x // expected-note {{captured here}}
153+
}
150154
}
151155
}
152156

@@ -166,8 +170,9 @@ class rdar40600800 {
166170
}
167171
}
168172

173+
// https://github.com/apple/swift/issues/57097
169174
// Make sure we can't capture an uninitialized 'var' box, either.
170-
func SR14747() {
175+
func f_57097() {
171176
func g() -> Int { // expected-error {{closure captures 'r' before it is declared}}
172177
_ = r // expected-note {{captured here}}
173178
return 5

test/SILGen/default_arguments.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ func testMagicLiterals(file: String = #file,
8484
//
8585
// NEGATIVE-NOT: sil hidden [ossa] @$s17default_arguments17testMagicLiteralsySS4file_SS8functionSi4lineSi6columntFfA2_
8686

87-
// SR-11623
87+
// https://github.com/apple/swift/issues/54034
88+
8889
func genericMagicLiteral<T : ExpressibleByIntegerLiteral>(_ x: T = #column) -> T { x }
8990

9091
// CHECK-LABEL: sil hidden [ossa] @$s17default_arguments23testGenericMagicLiteralyyF
@@ -411,7 +412,8 @@ func genericMagic<T : ExpressibleByStringLiteral>(x: T = #file) -> T {
411412

412413
let _: String = genericMagic()
413414

414-
// SR-11778
415+
// https://github.com/apple/swift/issues/54185
416+
415417
struct CallableWithDefault {
416418
func callAsFunction(x: Int = 4) {}
417419
func callAsFunction(y: Int, z: String = #function) {}

test/SILGen/default_arguments_local.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ class ArtClass<T> {
5858
}
5959
}
6060

61-
// Default arguments of local functions inside @inlinable contexts should be serialized.
62-
// https://bugs.swift.org/browse/SR-12404
61+
// Default arguments of local functions inside '@inlinable' contexts should
62+
// be serialized.
63+
// https://github.com/apple/swift/issues/54842
6364

6465
// CHECK-LABEL: sil [serialized] [ossa] @$s23default_arguments_local5outeryyF : $@convention(thin) () -> () {
6566
@inlinable public func outer() {

test/SILGen/default_constructor.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ struct I {
122122
init<T>(_: T) {}
123123
}
124124

125-
// https://bugs.swift.org/browse/SR-10075
125+
// https://github.com/apple/swift/issues/52477
126+
126127
func defaultValue<T>() -> T {
127128
fatalError()
128129
}

test/SILGen/dynamic_callable_attribute.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ class C {
6161

6262
// CHECK-LABEL: sil hidden [ossa] @$s26dynamic_callable_attribute05test_A10_callablesyyAA1SV_AA2P1_pAA2P2_pxtAA1CCRbzlF : $@convention(thin) <T where T : C> (S, @in_guaranteed any P1, @in_guaranteed any P2, @guaranteed T) -> ()
6363
func test_dynamic_callables<T : C>(_ s: S, _ p1: P1, _ p2: P2, _ t: T) {
64-
// SR-12615: Compiler crash on @dynamicCallable IUO.
64+
// https://github.com/apple/swift/issues/55059
65+
// Compiler crash on '@dynamicCallable' IUO.
66+
//
6567
// CHECK: function_ref @$s26dynamic_callable_attribute1SV15dynamicallyCall13withArgumentsSiSgSaySiG_tF : $@convention(method) (@guaranteed Array<Int>, S) -> Optional<Int>
6668
// CHECK: switch_enum %{{.+}} : $Optional<Int>
6769
let _: Int = s(0)

test/SILGen/dynamic_lookup.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,8 @@ func getIUOPropertyDynamically(x: AnyObject) -> Any {
393393
return x.iuoProperty
394394
}
395395

396-
// SR-11648
396+
// https://github.com/apple/swift/issues/54059
397+
//
397398
// CHECK-LABEL: sil hidden [ossa] @$s14dynamic_lookup24testAnyObjectWithDefaultyyyXlF
398399
func testAnyObjectWithDefault(_ x: AnyObject) {
399400
// CHECK: function_ref default argument 0 of X.hasDefaultParam(_:)

test/SILGen/enum.swift

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func makeIndirectEnum<T>(_ payload: T) -> Indirect<T> {
160160
return Indirect.payload((payload, other: payload))
161161
}
162162

163-
// https://bugs.swift.org/browse/SR-9675
163+
// https://github.com/apple/swift/issues/52118
164164

165165
enum TrailingClosureConcrete {
166166
case label(fn: () -> Int)
@@ -190,30 +190,32 @@ func useTrailingClosureGeneric<T>(t: T) {
190190
_ = TrailingClosureGeneric<T>.twoElementsNoLabel(t) { t }
191191
}
192192

193-
enum SR7799 {
193+
// https://github.com/apple/swift/issues/50338
194+
195+
enum OneOrTwo {
194196
case one
195197
case two
196198
}
197199

198-
// CHECK-LABEL: sil hidden [ossa] @$s4enum6sr77993baryAA6SR7799OSg_tF : $@convention(thin) (Optional<SR7799>) -> () {
199-
// CHECK: bb0(%0 : $Optional<SR7799>):
200-
// CHECK-NEXT: debug_value %0 : $Optional<SR7799>, let, name "bar", argno 1
201-
// CHECK-NEXT: switch_enum %0 : $Optional<SR7799>, case #Optional.some!enumelt: bb1, default bb4
202-
// CHECK: bb1([[PHI_ARG:%.*]] : $SR7799):
203-
// CHECK-NEXT: switch_enum [[PHI_ARG]] : $SR7799, case #SR7799.one!enumelt: bb2, case #SR7799.two!enumelt: bb3
204-
func sr7799(bar: SR7799?) {
200+
// CHECK-LABEL: sil hidden [ossa] @$s4enum18matchOptionalEnum13baryAA8OneOrTwoOSg_tF : $@convention(thin) (Optional<OneOrTwo>) -> () {
201+
// CHECK: bb0(%0 : $Optional<OneOrTwo>):
202+
// CHECK-NEXT: debug_value %0 : $Optional<OneOrTwo>, let, name "bar", argno 1
203+
// CHECK-NEXT: switch_enum %0 : $Optional<OneOrTwo>, case #Optional.some!enumelt: bb1, default bb4
204+
// CHECK: bb1([[PHI_ARG:%.*]] : $OneOrTwo):
205+
// CHECK-NEXT: switch_enum [[PHI_ARG]] : $OneOrTwo, case #OneOrTwo.one!enumelt: bb2, case #OneOrTwo.two!enumelt: bb3
206+
func matchOptionalEnum1(bar: OneOrTwo?) {
205207
switch bar {
206208
case .one: print("one")
207209
case .two?: print("two")
208210
default: print("default")
209211
}
210212
}
211213

212-
// CHECK-LABEL: sil hidden [ossa] @$s4enum8sr7799_13baryAA6SR7799OSgSg_tF : $@convention(thin) (Optional<Optional<SR7799>>) -> () {
213-
// CHECK: bb0(%0 : $Optional<Optional<SR7799>>):
214-
// CHECK-NEXT: debug_value %0 : $Optional<Optional<SR7799>>, let, name "bar", argno 1
215-
// CHECK-NEXT: switch_enum %0 : $Optional<Optional<SR7799>>, case #Optional.none!enumelt: bb1, default bb2
216-
func sr7799_1(bar: SR7799??) {
214+
// CHECK-LABEL: sil hidden [ossa] @$s4enum18matchOptionalEnum23baryAA8OneOrTwoOSgSg_tF : $@convention(thin) (Optional<Optional<OneOrTwo>>) -> () {
215+
// CHECK: bb0(%0 : $Optional<Optional<OneOrTwo>>):
216+
// CHECK-NEXT: debug_value %0 : $Optional<Optional<OneOrTwo>>, let, name "bar", argno 1
217+
// CHECK-NEXT: switch_enum %0 : $Optional<Optional<OneOrTwo>>, case #Optional.none!enumelt: bb1, default bb2
218+
func matchOptionalEnum2(bar: OneOrTwo??) {
217219
switch bar {
218220
case .none: print("none")
219221
default: print("default")

test/SILGen/enum_equatable_witness.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// RUN: %target-swift-emit-silgen -module-name main %s -verify | %FileCheck %s --check-prefix=FRAGILE
22
// RUN: %target-swift-emit-silgen -module-name main %s -verify -enable-library-evolution | %FileCheck %s --check-prefix=RESILIENT
33

4-
// SR-9425
4+
// https://github.com/apple/swift/issues/51889
5+
56
public enum MyState : String {
67
case closed = "closed"
78
case opened = "opened"

test/SILGen/foreach.swift

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,8 @@ func unusedArgPattern(_ xx: [Int]) {
603603
}
604604
}
605605

606-
// Test for SR-11269. Make sure that the sil contains the needed upcast.
606+
// https://github.com/apple/swift/issues/53670
607+
// Make sure that the SIL contains the needed upcast.
607608
//
608609
// CHECK-LABEL: sil hidden [ossa] @$s7foreach25genericFuncWithConversion4listySayxG_tAA1CCRbzlF
609610
// CHECK: bb2([[ITER_VAL:%.*]] : @owned $T):
@@ -614,9 +615,10 @@ func genericFuncWithConversion<T: C>(list : [T]) {
614615
}
615616
}
616617

617-
// SR-8688: Check that branch on result of next() precedes optional injection.
618-
// If we branch on the converted result of next(), the loop won't terminate.
619-
//
618+
// https://github.com/apple/swift/issues/51201
619+
// Check that branch on result of 'next()' precedes optional injection.
620+
// If we branch on the converted result of 'next()', the loop won't terminate.
621+
620622
// CHECK-LABEL: sil hidden [ossa] @$s7foreach32injectForEachElementIntoOptionalyySaySiGF
621623
// CHECK: [[NEXT_RESULT:%.*]] = load [trivial] {{.*}} : $*Optional<Int>
622624
// CHECK: switch_enum [[NEXT_RESULT]] : $Optional<Int>, case #Optional.some!enumelt: [[BB_SOME:bb.*]], case
@@ -627,9 +629,6 @@ func injectForEachElementIntoOptional(_ xs: [Int]) {
627629
for x : Int? in xs {}
628630
}
629631

630-
// SR-8688: Check that branch on result of next() precedes optional injection.
631-
// If we branch on the converted result of next(), the loop won't terminate.
632-
//
633632
// CHECK-LABEL: sil hidden [ossa] @$s7foreach32injectForEachElementIntoOptionalyySayxGlF
634633
// CHECK: copy_addr [take] [[NEXT_RESULT:%.*]] to [initialization] [[NEXT_RESULT_COPY:%.*]] : $*Optional<T>
635634
// CHECK: switch_enum_addr [[NEXT_RESULT_COPY]] : $*Optional<T>, case #Optional.some!enumelt: [[BB_SOME:bb.*]], case

test/SILGen/functions_uninhabited_param.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ func foo(baz: Never) -> Int { // expected-note {{'baz' is of type 'Never' which
1010

1111
func bar(baz: Never) -> Int {} // ok
1212

13-
// SR-13432
13+
// https://github.com/apple/swift/issues/55873
1414
func map<T>(_ block: (Never) -> T) {}
1515
map { arg in // expected-note {{'arg' is of type 'Never' which cannot be constructed because it is an enum with no cases}}
1616
5 // expected-warning {{will never be executed}}

test/SILGen/implicitly_unwrapped_optional.swift

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,25 +66,29 @@ func bind_any() {
6666
let object : AnyObject? = return_any()
6767
}
6868

69-
// CHECK-LABEL: sil hidden [ossa] @$s29implicitly_unwrapped_optional6sr3758yyF
70-
func sr3758() {
69+
// https://github.com/apple/swift/issues/46343
70+
//
71+
// CHECK-LABEL: sil hidden [ossa] @$s29implicitly_unwrapped_optional7f_46343yyF
72+
func f_46343() {
7173
// Verify that there are no additional reabstractions introduced.
72-
// CHECK: [[CLOSURE:%.+]] = function_ref @$s29implicitly_unwrapped_optional6sr3758yyFyypSgcfU_ : $@convention(thin) (@in_guaranteed Optional<Any>) -> ()
74+
// CHECK: [[CLOSURE:%.+]] = function_ref @$s29implicitly_unwrapped_optional7f_46343yyFyypSgcfU_ : $@convention(thin) (@in_guaranteed Optional<Any>) -> ()
7375
// CHECK: [[F:%.+]] = thin_to_thick_function [[CLOSURE]] : $@convention(thin) (@in_guaranteed Optional<Any>) -> () to $@callee_guaranteed (@in_guaranteed Optional<Any>) -> ()
7476
// CHECK: [[BORROWED_F:%.*]] = begin_borrow [[F]]
7577
// CHECK: = apply [[BORROWED_F]]({{%.+}}) : $@callee_guaranteed (@in_guaranteed Optional<Any>) -> ()
7678
// CHECK: end_borrow [[BORROWED_F]]
7779
let f: ((Any?) -> Void) = { (arg: Any!) in }
7880
f(nil)
79-
} // CHECK: end sil function '$s29implicitly_unwrapped_optional6sr3758yyF'
81+
} // CHECK: end sil function '$s29implicitly_unwrapped_optional7f_46343yyF'
82+
83+
// https://github.com/apple/swift/issues/52892
84+
// Make sure we can SILGen all of the below without crashing:
8085

81-
// SR-10492: Make sure we can SILGen all of the below without crashing:
82-
class SR_10492_C1 {
86+
class C1_52892 {
8387
init!() {}
8488
}
8589

86-
class SR_10492_C2 {
87-
init(_ foo: SR_10492_C1) {}
90+
class C2_52892 {
91+
init(_ foo: C1_52892) {}
8892
}
8993

9094
@objc class C {
@@ -106,7 +110,7 @@ struct S {
106110

107111
// Not really paren'd, but a previous version of the compiler modeled it
108112
// that way.
109-
let _ = SR_10492_C2(SR_10492_C1())
113+
let _ = C2_52892(C1_52892())
110114

111115
let _: C = (anyObj.foo)!()
112116
}

test/SILGen/inherit_initializers.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ class GenericWrapperNode<T : HasValue> : GenericSubNode<T.Value> {
9898
}
9999
}
100100

101-
// https://bugs.swift.org/browse/SR-3848 - Initializer with generic parameter
101+
// Initializer with generic parameter
102+
// https://github.com/apple/swift/issues/46433
103+
102104
protocol P {
103105
associatedtype T
104106
}

test/SILGen/keypaths_multi_file.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func bar<T>(_: T) {
3838
// _ = \P[0]
3939
}
4040

41-
// https://bugs.swift.org/browse/SR-8643
41+
// https://github.com/apple/swift/issues/51158
4242
class MM<T: P> : PP {}
4343
func foo<T3: BB, T4: MM<T3>>(t: T3, u: T4) {
4444
let _ = \CC<T4>.x

test/SILGen/lifetime_nonmutating_address_only.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %target-swift-emit-silgen -verify %s
22

3-
// SR-8990
3+
// https://github.com/apple/swift/issues/51493
44

55
protocol SomeProtocol { }
66
class SomeClass: SomeProtocol { }

0 commit comments

Comments
 (0)