Skip to content

Commit fde6f50

Browse files
committed
[Tests] NFC: Adjust any Sendable -> Any SILGen tests to match expected output format
`struct_extract` and `unchecked_trivial_bit_cast` instructions are printed slightly differently on main.
1 parent 06f81ee commit fde6f50

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

test/SILGen/sendable_to_any_for_generic_arguments.swift

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -69,53 +69,53 @@ struct TestGeneral {
6969
func sameType<T>(_: S<T>, _: T.Type) {}
7070

7171
// CHECK-LABEL: sil hidden [ossa] @$s37sendable_to_any_for_generic_arguments11TestGeneralV15test_contextualAA1SVyypGyF
72-
// CHECK: [[V_REF:%.*]] = struct_extract %0, #TestGeneral.v
73-
// CHECK-NEXT: {{.*}} = unchecked_trivial_bit_cast [[V_REF]] to $S<Any>
72+
// CHECK: [[V_REF:%.*]] = struct_extract %0 : $TestGeneral, #TestGeneral.v
73+
// CHECK-NEXT: {{.*}} = unchecked_trivial_bit_cast [[V_REF]] : $S<any Sendable> to $S<Any>
7474
func test_contextual() -> S<Any> {
7575
v
7676
}
7777

7878
// CHECK-LABEL: sil hidden [ossa] @$s37sendable_to_any_for_generic_arguments11TestGeneralV15test_member_refyyF
79-
// CHECK: [[V_REF:%.*]] = struct_extract %0, #TestGeneral.v
80-
// CHECK-NEXT: [[V_WITH_ANY:%.*]] = unchecked_trivial_bit_cast [[V_REF:%.*]] to $S<Any>
79+
// CHECK: [[V_REF:%.*]] = struct_extract %0 : $TestGeneral, #TestGeneral.v
80+
// CHECK-NEXT: [[V_WITH_ANY:%.*]] = unchecked_trivial_bit_cast [[V_REF:%.*]] : $S<any Sendable> to $S<Any>
8181
// CHECK: [[MEMBER_REF:%.*]] = function_ref @$s37sendable_to_any_for_generic_arguments1SVAAypRszlE0C4OnlyyyF : $@convention(method) (S<Any>) -> ()
8282
// CHECK-NEXT: {{.*}} = apply [[MEMBER_REF]]([[V_WITH_ANY:%.*]]) : $@convention(method) (S<Any>) -> ()
8383
func test_member_ref() {
8484
v.anyOnly()
8585
}
8686

8787
// CHECK-LABEL: sil hidden [ossa] @$s37sendable_to_any_for_generic_arguments11TestGeneralV24test_passing_as_argumentyyF
88-
// CHECK: [[V_REF:%.*]] = struct_extract %0, #TestGeneral.v
89-
// CHECK-NEXT: [[V_ANY:%.*]] = unchecked_trivial_bit_cast [[V_REF]] to $S<Any>
88+
// CHECK: [[V_REF:%.*]] = struct_extract %0 : $TestGeneral, #TestGeneral.v
89+
// CHECK-NEXT: [[V_ANY:%.*]] = unchecked_trivial_bit_cast [[V_REF]] : $S<any Sendable> to $S<Any>
9090
// CHECK: [[MEMBER_REF:%.*]] = function_ref @$s37sendable_to_any_for_generic_arguments11TestGeneralV08accepts_C0yyAA1SVyypGF : $@convention(method) (S<Any>, TestGeneral) -> ()
9191
// CHECK-NEXT: {{.*}} = apply [[MEMBER_REF]]([[V_ANY]], %0) : $@convention(method) (S<Any>, TestGeneral) -> ()
9292
func test_passing_as_argument() {
9393
accepts_any(v)
9494
}
9595

9696
// CHECK-LABEL: sil hidden [ossa] @$s37sendable_to_any_for_generic_arguments11TestGeneralV39test_passing_as_argument_through_member1tyAC_tF
97-
// CHECK: [[V_REF:%.*]] = struct_extract %0, #TestGeneral.v
98-
// CHECK-NEXT: [[V_ANY:%.*]] = unchecked_trivial_bit_cast [[V_REF]] to $S<Any>
97+
// CHECK: [[V_REF:%.*]] = struct_extract %0 : $TestGeneral, #TestGeneral.v
98+
// CHECK-NEXT: [[V_ANY:%.*]] = unchecked_trivial_bit_cast [[V_REF]] : $S<any Sendable> to $S<Any>
9999
// CHECK: [[MEMBER_REF:%.*]] = function_ref @$s37sendable_to_any_for_generic_arguments11TestGeneralV08accepts_C0yyAA1SVyypGF : $@convention(method) (S<Any>, TestGeneral) -> ()
100100
// CHECK-NEXT: {{.*}} = apply [[MEMBER_REF]]([[V_ANY]], %1) : $@convention(method) (S<Any>, TestGeneral) -> ()
101101
func test_passing_as_argument_through_member(t: TestGeneral) {
102102
accepts_any(t.v)
103103
}
104104

105105
// CHECK-LABEL: sil hidden [ossa] @$s37sendable_to_any_for_generic_arguments11TestGeneralV23test_complex_contextualAA1SVySayypSgGGyF
106-
// CHECK: [[V_REF:%.*]] = struct_extract %0, #TestGeneral.optV
107-
// CHECK-NEXT: {{.*}} = unchecked_trivial_bit_cast [[V_REF]] to $S<Array<Optional<Any>>>
106+
// CHECK: [[V_REF:%.*]] = struct_extract %0 : $TestGeneral, #TestGeneral.optV
107+
// CHECK-NEXT: {{.*}} = unchecked_trivial_bit_cast [[V_REF]] : $S<Array<Optional<any Sendable>>> to $S<Array<Optional<Any>>>
108108
func test_complex_contextual() -> S<[Any?]> {
109109
optV
110110
}
111111

112112
// CHECK-LABEL: sil hidden [ossa] @$s37sendable_to_any_for_generic_arguments11TestGeneralV26test_complex_with_argument1tyAC_tF
113-
// CHECK: [[SELF_V_REF:%.*]] = struct_extract %1, #TestGeneral.optV
114-
// CHECK-NEXT: [[SELF_V_ANY:%.*]] = unchecked_trivial_bit_cast [[SELF_V_REF]] to $S<Array<Optional<Any>>>
113+
// CHECK: [[SELF_V_REF:%.*]] = struct_extract %1 : $TestGeneral, #TestGeneral.optV
114+
// CHECK-NEXT: [[SELF_V_ANY:%.*]] = unchecked_trivial_bit_cast [[SELF_V_REF]] : $S<Array<Optional<any Sendable>>> to $S<Array<Optional<Any>>>
115115
// CHECK: [[MEMBER_REF_1:%.*]] = function_ref @$s37sendable_to_any_for_generic_arguments11TestGeneralV012accepts_opt_C0yyAA1SVySayypSgGGF : $@convention(method) (S<Array<Optional<Any>>>, TestGeneral) -> ()
116116
// CHECK-NEXT: {{.*}} = apply [[MEMBER_REF_1]]([[SELF_V_ANY]], %1) : $@convention(method) (S<Array<Optional<Any>>>, TestGeneral) -> ()
117-
// CHECK: [[V_REF_ON_T:%.*]] = struct_extract %0, #TestGeneral.optV
118-
// CHECK-NEXT: [[V_ANY_ON_T:%.]] = unchecked_trivial_bit_cast [[V_REF_ON_T]] to $S<Array<Optional<Any>>>
117+
// CHECK: [[V_REF_ON_T:%.*]] = struct_extract %0 : $TestGeneral, #TestGeneral.optV
118+
// CHECK-NEXT: [[V_ANY_ON_T:%.]] = unchecked_trivial_bit_cast [[V_REF_ON_T]] : $S<Array<Optional<any Sendable>>> to $S<Array<Optional<Any>>>
119119
// CHECK: [[MEMBER_REF_2:%.*]] = function_ref @$s37sendable_to_any_for_generic_arguments11TestGeneralV012accepts_opt_C0yyAA1SVySayypSgGGF : $@convention(method) (S<Array<Optional<Any>>>, TestGeneral) -> ()
120120
// CHECK-NEXT: {{.*}} = apply [[MEMBER_REF_2]]([[V_ANY_ON_T]], %1) : $@convention(method) (S<Array<Optional<Any>>>, TestGeneral) -> ()
121121
func test_complex_with_argument(t: TestGeneral) {
@@ -124,8 +124,8 @@ struct TestGeneral {
124124
}
125125

126126
// CHECK-LABEL: sil hidden [ossa] @$s37sendable_to_any_for_generic_arguments11TestGeneralV14test_same_typeyyF
127-
// CHECK: [[V_REF:%.*]] = struct_extract %0, #TestGeneral.v
128-
// CHECK-NEXT: [[V_ANY:%.*]] = unchecked_trivial_bit_cast [[V_REF]] to $S<Any>
127+
// CHECK: [[V_REF:%.*]] = struct_extract %0 : $TestGeneral, #TestGeneral.v
128+
// CHECK-NEXT: [[V_ANY:%.*]] = unchecked_trivial_bit_cast [[V_REF]] : $S<any Sendable> to $S<Any>
129129
// CHECK: [[ANY_METATYPE:%.*]] = metatype $@thick (any Any).Type
130130
// CHECK: [[SAME_TYPE_FN:%.*]] = function_ref @$s37sendable_to_any_for_generic_arguments11TestGeneralV8sameTypeyyAA1SVyxG_xmtlF : $@convention(method) <τ_0_0> (S<τ_0_0>, @thick τ_0_0.Type, TestGeneral) -> ()
131131
// CHECK-NEXT: %7 = apply %6<Any>([[V_ANY]], [[ANY_METATYPE]], %0)
@@ -134,10 +134,10 @@ struct TestGeneral {
134134
}
135135

136136
// CHECK-LABEL: sil hidden [ossa] @$s37sendable_to_any_for_generic_arguments11TestGeneralV18test_address_castsyyF
137-
// CHECK: [[DATA_REF:%.*]] = struct_element_addr %2, #<abstract function>Test.data
137+
// CHECK: [[DATA_REF:%.*]] = struct_element_addr %2 : $*Test, #<abstract function>Test.data
138138
// CHECK-NEXT: [[DATA_COPY:%.*]] = alloc_stack $V<any Sendable>
139139
// CHECK-NEXT: copy_addr [[DATA_REF]] to [init] [[DATA_COPY]]
140-
// CHECK-NEXT: [[DATA_ANY:%.*]] = unchecked_addr_cast [[DATA_COPY]] to $*V<Any>
140+
// CHECK-NEXT: [[DATA_ANY:%.*]] = unchecked_addr_cast [[DATA_COPY]] : $*V<any Sendable> to $*V<Any>
141141
// CHECK: [[ACCEPTS_ANY:%.*]] = function_ref @$s37sendable_to_any_for_generic_arguments11TestGeneralV18test_address_castsyyF08accepts_C0L_yyAcDyyF1VL_VyypGF : $@convention(thin) (@in_guaranteed V<Any>) -> ()
142142
// CHECK-NEXT: {{.*}} = apply [[ACCEPTS_ANY]]([[DATA_ANY]]) : $@convention(thin) (@in_guaranteed V<Any>) -> ()
143143
func test_address_casts() {
@@ -157,11 +157,11 @@ struct TestGeneral {
157157
}
158158

159159
// CHECK-LABEL: sil hidden [ossa] @$s37sendable_to_any_for_generic_arguments11TestGeneralV023test_function_types_as_E5_argsyyF
160-
// CHECK: [[FUNCV_REF:%.*]] = struct_extract %0, #TestGeneral.funcV
161-
// CHECK-NEXT: %3 = unchecked_trivial_bit_cast [[FUNCV_REF]] to $S<(Array<Any>) -> Optional<Any>>
162-
// CHECK: [[DATA_REF:%.*]] = struct_extract %20, #<abstract function>Test.data
160+
// CHECK: [[FUNCV_REF:%.*]] = struct_extract %0 : $TestGeneral, #TestGeneral.funcV
161+
// CHECK-NEXT: %3 = unchecked_trivial_bit_cast [[FUNCV_REF]] : $S<(Array<any Sendable>) -> Optional<any Sendable>> to $S<(Array<Any>) -> Optional<Any>>
162+
// CHECK: [[DATA_REF:%.*]] = struct_extract %20 : $Test, #<abstract function>Test.data
163163
// CHECK-NEXT: [[DATA_COPY:%.*]] = copy_value [[DATA_REF]]
164-
// CHECK-NEXT: [[DATA_ANY:%.*]] = unchecked_value_cast [[DATA_COPY]] to $V<(Array<Any>) -> Any>
164+
// CHECK-NEXT: [[DATA_ANY:%.*]] = unchecked_value_cast [[DATA_COPY]] : $V<(Array<any Sendable>) -> any Sendable> to $V<(Array<Any>) -> Any>
165165
// CHECK: [[ACCEPTS_ANY:%.*]] = function_ref @$s37sendable_to_any_for_generic_arguments11TestGeneralV023test_function_types_as_E5_argsyyF08accepts_C0L_yyAcDyyF1VL_VyypSayypGcGF : $@convention(thin) (@guaranteed V<(Array<Any>) -> Any>) -> ()
166166
// CHECK-NEXT: {{.*}} = apply [[ACCEPTS_ANY]]([[DATA_ANY]]) : $@convention(thin) (@guaranteed V<(Array<Any>) -> Any>) -> ()
167167
func test_function_types_as_generic_args() {

0 commit comments

Comments
 (0)