|
1 | 1 | // RUN: %target-swift-emit-silgen \
|
2 | 2 | // RUN: %s \
|
| 3 | +// RUN: -enable-library-evolution \ |
3 | 4 | // RUN: -enable-experimental-feature CoroutineAccessors \
|
4 | 5 | // RUN: | %FileCheck %s --check-prefixes=CHECK,CHECK-NOUNWIND
|
5 | 6 |
|
6 | 7 | // RUN: %target-swift-emit-silgen \
|
7 | 8 | // RUN: %s \
|
| 9 | +// RUN: -enable-library-evolution \ |
8 | 10 | // RUN: -enable-experimental-feature CoroutineAccessors \
|
9 | 11 | // RUN: -enable-experimental-feature CoroutineAccessorsUnwindOnCallerError \
|
10 | 12 | // RUN: | %FileCheck %s --check-prefixes=CHECK,CHECK-UNWIND
|
|
19 | 21 | // - a get accessor
|
20 | 22 | // - an unsafeAddress accessor
|
21 | 23 |
|
22 |
| -struct U : ~Copyable {} |
| 24 | +@frozen |
| 25 | +public struct U : ~Copyable {} |
23 | 26 |
|
24 | 27 | // Protocols are split up to improve the ordering of the functions in the output
|
25 | 28 | // (implementation, then conformance thunk).
|
26 |
| -protocol P1 : ~Copyable { |
| 29 | +public protocol P1 : ~Copyable { |
27 | 30 | @_borrowed
|
28 | 31 | var ubgs: U { get set }
|
29 | 32 | }
|
30 |
| -protocol P2 : ~Copyable { |
| 33 | +public protocol P2 : ~Copyable { |
31 | 34 | var urs: U { read set }
|
32 | 35 | }
|
33 |
| -protocol P3 : ~Copyable { |
| 36 | +public protocol P3 : ~Copyable { |
34 | 37 | var ur: U { read }
|
35 | 38 | }
|
36 | 39 |
|
37 |
| -struct ImplAStored : ~Copyable & P1 { |
38 |
| - var ubgs: U |
| 40 | +@frozen |
| 41 | +public struct ImplAStored : ~Copyable & P1 { |
| 42 | + public var ubgs: U |
39 | 43 | // CHECK-LABEL: sil{{.*}} [ossa] @$s17read_requirements11ImplAStoredV4ubgsAA1UVvr : {{.*}} {
|
40 | 44 | // CHECK: bb0(
|
41 | 45 | // CHECK-SAME: [[SELF:%[^:]+]]
|
@@ -78,9 +82,10 @@ struct ImplAStored : ~Copyable & P1 {
|
78 | 82 | // CHECK-LABEL: } // end sil function '$s17read_requirements11ImplAStoredVAA2P1A2aDP4ubgsAA1UVvrTW'
|
79 | 83 | }
|
80 | 84 |
|
81 |
| -struct ImplBStored : ~Copyable & P2 { |
| 85 | +@frozen |
| 86 | +public struct ImplBStored : ~Copyable & P2 { |
82 | 87 | var dummy: ()
|
83 |
| - var urs: U |
| 88 | + public var urs: U |
84 | 89 | // CHECK-LABEL: sil{{.*}} [ossa] @$s17read_requirements11ImplBStoredV3ursAA1UVvr : {{.*}} {
|
85 | 90 | // CHECK: bb0(
|
86 | 91 | // CHECK-SAME: [[SELF:%[^:]+]]
|
@@ -124,9 +129,10 @@ struct ImplBStored : ~Copyable & P2 {
|
124 | 129 | // CHECK-LABEL: } // end sil function '$s17read_requirements11ImplBStoredVAA2P2A2aDP3ursAA1UVvrTW'
|
125 | 130 | }
|
126 | 131 |
|
127 |
| -struct ImplCStored : ~Copyable & P3 { |
| 132 | +@frozen |
| 133 | +public struct ImplCStored : ~Copyable & P3 { |
128 | 134 | var dummy: ()
|
129 |
| - var ur: U |
| 135 | + public var ur: U |
130 | 136 | // CHECK-LABEL: sil{{.*}} [ossa] @$s17read_requirements11ImplCStoredV2urAA1UVvr : {{.*}} {
|
131 | 137 | // CHECK: bb0(
|
132 | 138 | // CHECK-SAME: [[SELF:%[^:]+]]
|
@@ -169,10 +175,10 @@ struct ImplCStored : ~Copyable & P3 {
|
169 | 175 | // CHECK-LABEL: } // end sil function '$s17read_requirements11ImplCStoredVAA2P3A2aDP2urAA1UVvrTW'
|
170 | 176 | }
|
171 | 177 |
|
172 |
| -struct ImplAUnderscoredCoroutineAccessors : ~Copyable & P1 { |
173 |
| - typealias Property = U |
| 178 | +@frozen |
| 179 | +public struct ImplAUnderscoredCoroutineAccessors : ~Copyable & P1 { |
174 | 180 | var _i: U
|
175 |
| - var ubgs: U { |
| 181 | + public var ubgs: U { |
176 | 182 | _read {
|
177 | 183 | yield _i
|
178 | 184 | }
|
@@ -222,10 +228,10 @@ struct ImplAUnderscoredCoroutineAccessors : ~Copyable & P1 {
|
222 | 228 | // CHECK-LABEL: } // end sil function '$s17read_requirements34ImplAUnderscoredCoroutineAccessorsVAA2P1A2aDP4ubgsAA1UVvrTW'
|
223 | 229 | }
|
224 | 230 |
|
225 |
| -struct ImplBUnderscoredCoroutineAccessors : ~Copyable & P2 { |
226 |
| - typealias Property = U |
| 231 | +@frozen |
| 232 | +public struct ImplBUnderscoredCoroutineAccessors : ~Copyable & P2 { |
227 | 233 | var _i: U
|
228 |
| - var urs: U { |
| 234 | + public var urs: U { |
229 | 235 | _read {
|
230 | 236 | yield _i
|
231 | 237 | }
|
@@ -275,10 +281,10 @@ struct ImplBUnderscoredCoroutineAccessors : ~Copyable & P2 {
|
275 | 281 | // CHECK-LABEL: } // end sil function '$s17read_requirements34ImplBUnderscoredCoroutineAccessorsVAA2P2A2aDP3ursAA1UVvrTW'
|
276 | 282 | }
|
277 | 283 |
|
278 |
| -struct ImplCUnderscoredCoroutineAccessors : ~Copyable & P3 { |
279 |
| - typealias Property = U |
| 284 | +@frozen |
| 285 | +public struct ImplCUnderscoredCoroutineAccessors : ~Copyable & P3 { |
280 | 286 | var _i: U
|
281 |
| - var ur: U { |
| 287 | + public var ur: U { |
282 | 288 | _read {
|
283 | 289 | yield _i
|
284 | 290 | }
|
@@ -388,9 +394,10 @@ struct ImplACoroutineAccessors : ~Copyable & P1 {
|
388 | 394 | // CHECK-LABEL: } // end sil function '$s17read_requirements23ImplACoroutineAccessorsVAA2P1A2aDP4ubgsAA1UVvrTW'
|
389 | 395 | }
|
390 | 396 |
|
391 |
| -struct ImplBCoroutineAccessors : ~Copyable & P2 { |
| 397 | +@frozen |
| 398 | +public struct ImplBCoroutineAccessors : ~Copyable & P2 { |
392 | 399 | var _i: U
|
393 |
| - var urs: U { |
| 400 | + public var urs: U { |
394 | 401 | read {
|
395 | 402 | yield _i
|
396 | 403 | }
|
@@ -472,9 +479,10 @@ struct ImplBCoroutineAccessors : ~Copyable & P2 {
|
472 | 479 | // CHECK-LABEL: } // end sil function '$s17read_requirements23ImplBCoroutineAccessorsVAA2P2A2aDP3ursAA1UVvrTW'
|
473 | 480 | }
|
474 | 481 |
|
475 |
| -struct ImplCCoroutineAccessors : ~Copyable & P3 { |
| 482 | +@frozen |
| 483 | +public struct ImplCCoroutineAccessors : ~Copyable & P3 { |
476 | 484 | var _i: U
|
477 |
| - var ur: U { |
| 485 | + public var ur: U { |
478 | 486 | read {
|
479 | 487 | yield _i
|
480 | 488 | }
|
@@ -553,12 +561,13 @@ struct ImplCCoroutineAccessors : ~Copyable & P3 {
|
553 | 561 | // CHECK-LABEL: } // end sil function '$s17read_requirements23ImplCCoroutineAccessorsVAA2P3A2aDP2urAA1UVvrTW'
|
554 | 562 | }
|
555 | 563 |
|
556 |
| -struct ImplAGetSet : P1 { |
| 564 | +@frozen |
| 565 | +public struct ImplAGetSet : P1 { |
557 | 566 | var _i: U {
|
558 | 567 | get { return U() }
|
559 | 568 | set {}
|
560 | 569 | }
|
561 |
| - var ubgs: U { |
| 570 | + public var ubgs: U { |
562 | 571 | get {
|
563 | 572 | return _i
|
564 | 573 | }
|
@@ -612,12 +621,13 @@ struct ImplAGetSet : P1 {
|
612 | 621 | // CHECK-LABEL: } // end sil function '$s17read_requirements11ImplAGetSetVAA2P1A2aDP4ubgsAA1UVvrTW'
|
613 | 622 | }
|
614 | 623 |
|
615 |
| -struct ImplBGetSet : P2 { |
| 624 | +@frozen |
| 625 | +public struct ImplBGetSet : P2 { |
616 | 626 | var _i: U {
|
617 | 627 | get { return U() }
|
618 | 628 | set {}
|
619 | 629 | }
|
620 |
| - var urs: U { |
| 630 | + public var urs: U { |
621 | 631 | get {
|
622 | 632 | return _i
|
623 | 633 | }
|
@@ -671,12 +681,13 @@ struct ImplBGetSet : P2 {
|
671 | 681 | // CHECK-LABEL: } // end sil function '$s17read_requirements11ImplBGetSetVAA2P2A2aDP3ursAA1UVvrTW'
|
672 | 682 | }
|
673 | 683 |
|
674 |
| -struct ImplCGetSet : P3 { |
| 684 | +@frozen |
| 685 | +public struct ImplCGetSet : P3 { |
675 | 686 | var _i: U {
|
676 | 687 | get { return U() }
|
677 | 688 | set {}
|
678 | 689 | }
|
679 |
| - var ur: U { |
| 690 | + public var ur: U { |
680 | 691 | get {
|
681 | 692 | return _i
|
682 | 693 | }
|
@@ -727,12 +738,13 @@ struct ImplCGetSet : P3 {
|
727 | 738 | // CHECK-LABEL: } // end sil function '$s17read_requirements11ImplCGetSetVAA2P3A2aDP2urAA1UVvrTW'
|
728 | 739 | }
|
729 | 740 |
|
730 |
| -struct ImplAUnsafeAddressors : P1 { |
| 741 | +@frozen |
| 742 | +public struct ImplAUnsafeAddressors : P1 { |
731 | 743 | var iAddr: UnsafePointer<U>
|
732 | 744 | var iMutableAddr: UnsafeMutablePointer<U> {
|
733 | 745 | .init(mutating: iAddr)
|
734 | 746 | }
|
735 |
| - var ubgs: U { |
| 747 | + public var ubgs: U { |
736 | 748 | unsafeAddress {
|
737 | 749 | return iAddr
|
738 | 750 | }
|
@@ -790,12 +802,13 @@ struct ImplAUnsafeAddressors : P1 {
|
790 | 802 | // CHECK-LABEL: } // end sil function '$s17read_requirements21ImplAUnsafeAddressorsVAA2P1A2aDP4ubgsAA1UVvrTW'
|
791 | 803 | }
|
792 | 804 |
|
793 |
| -struct ImplBUnsafeAddressors : P2 { |
| 805 | +@frozen |
| 806 | +public struct ImplBUnsafeAddressors : P2 { |
794 | 807 | var iAddr: UnsafePointer<U>
|
795 | 808 | var iMutableAddr: UnsafeMutablePointer<U> {
|
796 | 809 | .init(mutating: iAddr)
|
797 | 810 | }
|
798 |
| - var urs: U { |
| 811 | + public var urs: U { |
799 | 812 | unsafeAddress {
|
800 | 813 | return iAddr
|
801 | 814 | }
|
@@ -854,12 +867,13 @@ struct ImplBUnsafeAddressors : P2 {
|
854 | 867 | // CHECK-LABEL: } // end sil function '$s17read_requirements21ImplBUnsafeAddressorsVAA2P2A2aDP3ursAA1UVvrTW'
|
855 | 868 | }
|
856 | 869 |
|
857 |
| -struct ImplCUnsafeAddressors : P3 { |
| 870 | +@frozen |
| 871 | +public struct ImplCUnsafeAddressors : P3 { |
858 | 872 | var iAddr: UnsafePointer<U>
|
859 | 873 | var iMutableAddr: UnsafeMutablePointer<U> {
|
860 | 874 | .init(mutating: iAddr)
|
861 | 875 | }
|
862 |
| - var ur: U { |
| 876 | + public var ur: U { |
863 | 877 | unsafeAddress {
|
864 | 878 | return iAddr
|
865 | 879 | }
|
|
0 commit comments