Skip to content

Commit 459bdb0

Browse files
committed
[Test] Evolvingly export some types.
In preparation for putting read2 and modify2 into witness tables and only including read and modify in them when appropriate, export these types, mark the module resilient, but mark the types frozen. This keeps the test passing as written.
1 parent defb819 commit 459bdb0

File tree

3 files changed

+54
-35
lines changed

3 files changed

+54
-35
lines changed

test/IRGen/coroutine_accessors.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// RUN: %target-swift-emit-irgen \
22
// RUN: %s \
33
// RUN: -enable-experimental-feature CoroutineAccessors \
4+
// RUN: -enable-library-evolution \
45
// RUN: | %IRGenFileCheck %s --check-prefix=CHECK-OLD
56

67
// For now, a crash is expected when attempting to use the callee-allocated ABI:
@@ -13,6 +14,7 @@
1314

1415
// REQUIRES: asserts
1516

17+
@frozen
1618
public struct S {
1719
public var o: any AnyObject
1820
public var _i: Int = 0

test/SILGen/coroutine_accessors.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
// RUN: %target-swift-emit-silgen \
22
// RUN: %s \
3+
// RUN: -enable-library-evolution \
34
// RUN: -enable-experimental-feature CoroutineAccessors \
45
// RUN: | %FileCheck %s --check-prefixes=CHECK,CHECK-NOUNWIND
56

67
// RUN: %target-swift-emit-silgen \
78
// RUN: %s \
9+
// RUN: -enable-library-evolution \
810
// RUN: -enable-experimental-feature CoroutineAccessors \
911
// RUN: -enable-experimental-feature CoroutineAccessorsUnwindOnCallerError \
1012
// RUN: | %FileCheck %s --check-prefixes=CHECK,CHECK-UNWIND
1113

1214
// REQUIRES: asserts
1315

16+
@frozen
1417
public struct S {
1518
public var o: any AnyObject
1619
public var _i: Int = 0

test/SILGen/read_requirements.swift

Lines changed: 49 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
// RUN: %target-swift-emit-silgen \
22
// RUN: %s \
3+
// RUN: -enable-library-evolution \
34
// RUN: -enable-experimental-feature CoroutineAccessors \
45
// RUN: | %FileCheck %s --check-prefixes=CHECK,CHECK-NOUNWIND
56

67
// RUN: %target-swift-emit-silgen \
78
// RUN: %s \
9+
// RUN: -enable-library-evolution \
810
// RUN: -enable-experimental-feature CoroutineAccessors \
911
// RUN: -enable-experimental-feature CoroutineAccessorsUnwindOnCallerError \
1012
// RUN: | %FileCheck %s --check-prefixes=CHECK,CHECK-UNWIND
@@ -19,23 +21,25 @@
1921
// - a get accessor
2022
// - an unsafeAddress accessor
2123

22-
struct U : ~Copyable {}
24+
@frozen
25+
public struct U : ~Copyable {}
2326

2427
// Protocols are split up to improve the ordering of the functions in the output
2528
// (implementation, then conformance thunk).
26-
protocol P1 : ~Copyable {
29+
public protocol P1 : ~Copyable {
2730
@_borrowed
2831
var ubgs: U { get set }
2932
}
30-
protocol P2 : ~Copyable {
33+
public protocol P2 : ~Copyable {
3134
var urs: U { read set }
3235
}
33-
protocol P3 : ~Copyable {
36+
public protocol P3 : ~Copyable {
3437
var ur: U { read }
3538
}
3639

37-
struct ImplAStored : ~Copyable & P1 {
38-
var ubgs: U
40+
@frozen
41+
public struct ImplAStored : ~Copyable & P1 {
42+
public var ubgs: U
3943
// CHECK-LABEL: sil{{.*}} [ossa] @$s17read_requirements11ImplAStoredV4ubgsAA1UVvr : {{.*}} {
4044
// CHECK: bb0(
4145
// CHECK-SAME: [[SELF:%[^:]+]]
@@ -78,9 +82,10 @@ struct ImplAStored : ~Copyable & P1 {
7882
// CHECK-LABEL: } // end sil function '$s17read_requirements11ImplAStoredVAA2P1A2aDP4ubgsAA1UVvrTW'
7983
}
8084

81-
struct ImplBStored : ~Copyable & P2 {
85+
@frozen
86+
public struct ImplBStored : ~Copyable & P2 {
8287
var dummy: ()
83-
var urs: U
88+
public var urs: U
8489
// CHECK-LABEL: sil{{.*}} [ossa] @$s17read_requirements11ImplBStoredV3ursAA1UVvr : {{.*}} {
8590
// CHECK: bb0(
8691
// CHECK-SAME: [[SELF:%[^:]+]]
@@ -124,9 +129,10 @@ struct ImplBStored : ~Copyable & P2 {
124129
// CHECK-LABEL: } // end sil function '$s17read_requirements11ImplBStoredVAA2P2A2aDP3ursAA1UVvrTW'
125130
}
126131

127-
struct ImplCStored : ~Copyable & P3 {
132+
@frozen
133+
public struct ImplCStored : ~Copyable & P3 {
128134
var dummy: ()
129-
var ur: U
135+
public var ur: U
130136
// CHECK-LABEL: sil{{.*}} [ossa] @$s17read_requirements11ImplCStoredV2urAA1UVvr : {{.*}} {
131137
// CHECK: bb0(
132138
// CHECK-SAME: [[SELF:%[^:]+]]
@@ -169,10 +175,10 @@ struct ImplCStored : ~Copyable & P3 {
169175
// CHECK-LABEL: } // end sil function '$s17read_requirements11ImplCStoredVAA2P3A2aDP2urAA1UVvrTW'
170176
}
171177

172-
struct ImplAUnderscoredCoroutineAccessors : ~Copyable & P1 {
173-
typealias Property = U
178+
@frozen
179+
public struct ImplAUnderscoredCoroutineAccessors : ~Copyable & P1 {
174180
var _i: U
175-
var ubgs: U {
181+
public var ubgs: U {
176182
_read {
177183
yield _i
178184
}
@@ -222,10 +228,10 @@ struct ImplAUnderscoredCoroutineAccessors : ~Copyable & P1 {
222228
// CHECK-LABEL: } // end sil function '$s17read_requirements34ImplAUnderscoredCoroutineAccessorsVAA2P1A2aDP4ubgsAA1UVvrTW'
223229
}
224230

225-
struct ImplBUnderscoredCoroutineAccessors : ~Copyable & P2 {
226-
typealias Property = U
231+
@frozen
232+
public struct ImplBUnderscoredCoroutineAccessors : ~Copyable & P2 {
227233
var _i: U
228-
var urs: U {
234+
public var urs: U {
229235
_read {
230236
yield _i
231237
}
@@ -275,10 +281,10 @@ struct ImplBUnderscoredCoroutineAccessors : ~Copyable & P2 {
275281
// CHECK-LABEL: } // end sil function '$s17read_requirements34ImplBUnderscoredCoroutineAccessorsVAA2P2A2aDP3ursAA1UVvrTW'
276282
}
277283

278-
struct ImplCUnderscoredCoroutineAccessors : ~Copyable & P3 {
279-
typealias Property = U
284+
@frozen
285+
public struct ImplCUnderscoredCoroutineAccessors : ~Copyable & P3 {
280286
var _i: U
281-
var ur: U {
287+
public var ur: U {
282288
_read {
283289
yield _i
284290
}
@@ -388,9 +394,10 @@ struct ImplACoroutineAccessors : ~Copyable & P1 {
388394
// CHECK-LABEL: } // end sil function '$s17read_requirements23ImplACoroutineAccessorsVAA2P1A2aDP4ubgsAA1UVvrTW'
389395
}
390396

391-
struct ImplBCoroutineAccessors : ~Copyable & P2 {
397+
@frozen
398+
public struct ImplBCoroutineAccessors : ~Copyable & P2 {
392399
var _i: U
393-
var urs: U {
400+
public var urs: U {
394401
read {
395402
yield _i
396403
}
@@ -472,9 +479,10 @@ struct ImplBCoroutineAccessors : ~Copyable & P2 {
472479
// CHECK-LABEL: } // end sil function '$s17read_requirements23ImplBCoroutineAccessorsVAA2P2A2aDP3ursAA1UVvrTW'
473480
}
474481

475-
struct ImplCCoroutineAccessors : ~Copyable & P3 {
482+
@frozen
483+
public struct ImplCCoroutineAccessors : ~Copyable & P3 {
476484
var _i: U
477-
var ur: U {
485+
public var ur: U {
478486
read {
479487
yield _i
480488
}
@@ -553,12 +561,13 @@ struct ImplCCoroutineAccessors : ~Copyable & P3 {
553561
// CHECK-LABEL: } // end sil function '$s17read_requirements23ImplCCoroutineAccessorsVAA2P3A2aDP2urAA1UVvrTW'
554562
}
555563

556-
struct ImplAGetSet : P1 {
564+
@frozen
565+
public struct ImplAGetSet : P1 {
557566
var _i: U {
558567
get { return U() }
559568
set {}
560569
}
561-
var ubgs: U {
570+
public var ubgs: U {
562571
get {
563572
return _i
564573
}
@@ -612,12 +621,13 @@ struct ImplAGetSet : P1 {
612621
// CHECK-LABEL: } // end sil function '$s17read_requirements11ImplAGetSetVAA2P1A2aDP4ubgsAA1UVvrTW'
613622
}
614623

615-
struct ImplBGetSet : P2 {
624+
@frozen
625+
public struct ImplBGetSet : P2 {
616626
var _i: U {
617627
get { return U() }
618628
set {}
619629
}
620-
var urs: U {
630+
public var urs: U {
621631
get {
622632
return _i
623633
}
@@ -671,12 +681,13 @@ struct ImplBGetSet : P2 {
671681
// CHECK-LABEL: } // end sil function '$s17read_requirements11ImplBGetSetVAA2P2A2aDP3ursAA1UVvrTW'
672682
}
673683

674-
struct ImplCGetSet : P3 {
684+
@frozen
685+
public struct ImplCGetSet : P3 {
675686
var _i: U {
676687
get { return U() }
677688
set {}
678689
}
679-
var ur: U {
690+
public var ur: U {
680691
get {
681692
return _i
682693
}
@@ -727,12 +738,13 @@ struct ImplCGetSet : P3 {
727738
// CHECK-LABEL: } // end sil function '$s17read_requirements11ImplCGetSetVAA2P3A2aDP2urAA1UVvrTW'
728739
}
729740

730-
struct ImplAUnsafeAddressors : P1 {
741+
@frozen
742+
public struct ImplAUnsafeAddressors : P1 {
731743
var iAddr: UnsafePointer<U>
732744
var iMutableAddr: UnsafeMutablePointer<U> {
733745
.init(mutating: iAddr)
734746
}
735-
var ubgs: U {
747+
public var ubgs: U {
736748
unsafeAddress {
737749
return iAddr
738750
}
@@ -790,12 +802,13 @@ struct ImplAUnsafeAddressors : P1 {
790802
// CHECK-LABEL: } // end sil function '$s17read_requirements21ImplAUnsafeAddressorsVAA2P1A2aDP4ubgsAA1UVvrTW'
791803
}
792804

793-
struct ImplBUnsafeAddressors : P2 {
805+
@frozen
806+
public struct ImplBUnsafeAddressors : P2 {
794807
var iAddr: UnsafePointer<U>
795808
var iMutableAddr: UnsafeMutablePointer<U> {
796809
.init(mutating: iAddr)
797810
}
798-
var urs: U {
811+
public var urs: U {
799812
unsafeAddress {
800813
return iAddr
801814
}
@@ -854,12 +867,13 @@ struct ImplBUnsafeAddressors : P2 {
854867
// CHECK-LABEL: } // end sil function '$s17read_requirements21ImplBUnsafeAddressorsVAA2P2A2aDP3ursAA1UVvrTW'
855868
}
856869

857-
struct ImplCUnsafeAddressors : P3 {
870+
@frozen
871+
public struct ImplCUnsafeAddressors : P3 {
858872
var iAddr: UnsafePointer<U>
859873
var iMutableAddr: UnsafeMutablePointer<U> {
860874
.init(mutating: iAddr)
861875
}
862-
var ur: U {
876+
public var ur: U {
863877
unsafeAddress {
864878
return iAddr
865879
}

0 commit comments

Comments
 (0)