@@ -19,12 +19,20 @@ struct State1: StateProtocol {
19
19
20
20
var state = State ( )
21
21
state. values = Array ( repeating: " " , count: 20000 )
22
- // CHECK: [[BEGIN_ACCESS_MODIFY:%.*]] = begin_access [modify] [dynamic] {{%.*}} : $*State
23
- // CHECK: [[REF_MODIFY:%.*]] = function_ref @$s26property_wrapper_coroutine5StateV6valuesSaySSGvM : $@yield_once @convention(method) (@inout State) -> @yields @inout Array<String>
24
- // CHECK: ([[RES1:%.*]], {{%.*}}) = begin_apply [[REF_MODIFY]]([[BEGIN_ACCESS_MODIFY]]) : $@yield_once @convention(method) (@inout State) -> @yields @inout Array<String>
22
+ state. values [ 1000 ] = " foo "
23
+
24
+ let state1 = State1 ( )
25
+ _ = state1. someValues
26
+
27
+ // >> Check that the subscript assignment uses the _modify coroutine
28
+
29
+ // CHECK: {{%.*}} = begin_access [modify] [dynamic] {{%.*}} : $*State
30
+ // CHECK: [[REF_VALUES_MODIFY:%.*]] = function_ref @$s26property_wrapper_coroutine5StateV6valuesSaySSGvM : $@yield_once @convention(method) (@inout State) -> @yields @inout Array<String>
31
+ // CHECK: ([[RES1:%.*]], {{%.*}}) = begin_apply [[REF_VALUES_MODIFY]]({{%.*}}) : $@yield_once @convention(method) (@inout State) -> @yields @inout Array<String>
25
32
// CHECK: [[REF_ARRAY_SUBSCRIPT:%.*]] = function_ref @$sSayxSiciM : $@yield_once @convention(method) <τ_0_0> (Int, @inout Array<τ_0_0>) -> @yields @inout τ_0_0
26
33
// CHECK: ({{%.*}}, {{%.*}}) = begin_apply [[REF_ARRAY_SUBSCRIPT]]<String>({{%.*}}, [[RES1]]) : $@yield_once @convention(method) <τ_0_0> (Int, @inout Array<τ_0_0>) -> @yields @inout τ_0_0
27
- state. values [ 1000 ] = " foo "
34
+
35
+ // >> Check that the _modify coroutine is synthesized properly
28
36
29
37
// CHECK-LABEL: sil hidden [transparent] [ossa] @$s26property_wrapper_coroutine5StateV6valuesSaySSGvM : $@yield_once @convention(method) (@inout State) -> @yields @inout Array<String> {
30
38
// CHECK: bb0([[STATE:%.*]] : $*State):
@@ -44,15 +52,14 @@ state.values[1000] = "foo"
44
52
// CHECK: unwind
45
53
// CHECK-END: }
46
54
47
- var state1 = State1 ( )
48
- _ = state1. someValues
55
+ // >> Check that the _read coroutine is synthesized properly
49
56
50
57
// CHECK-LABEL: sil shared [ossa] @$s26property_wrapper_coroutine6State1V10someValuesSaySSGvr : $@yield_once @convention(method) (@guaranteed State1) -> @yields @guaranteed Array<String> {
51
58
// CHECK: bb0([[STATE1:%.*]] : @guaranteed $State1):
52
59
// CHECK: debug_value [[SELF:%.*]] : $State1, let, name "self", argno {{.*}}
53
60
// CHECK: [[EXTRACT_VALUE:%.*]] = struct_extract %0 : $State1, #State1._someValues
54
61
// CHECK: [[COPY_VALUE:%.*]] = copy_value [[EXTRACT_VALUE]] : $TestWrapper<Array<String>>
55
- // CHECK: [[BEGIN_BORROW:%.*]] = begin_borrow [[COPY ]] : $TestWrapper<Array<String>>
62
+ // CHECK: [[BEGIN_BORROW:%.*]] = begin_borrow [[COPY_VALUE ]] : $TestWrapper<Array<String>>
56
63
// CHECK: [[EXTRACT_WRAPPEDVALUE:%.*]] = struct_extract [[BEGIN_BORROW]] : $TestWrapper<Array<String>>, #TestWrapper.wrappedValue
57
64
// CHECK: yield [[EXTRACT_WRAPPEDVALUE]] : $Array<String>, resume bb1, unwind bb2
58
65
//
0 commit comments