@@ -30,6 +30,21 @@ enum E: String {
30
30
case a, b, c, d, e
31
31
}
32
32
33
+ protocol P2 {
34
+ associatedtype A: Q
35
+ }
36
+
37
+ protocol Q {
38
+ }
39
+
40
+ public struct S2: P2 {
41
+ var x: String
42
+ struct A: Q {
43
+ var y: String
44
+ }
45
+ }
46
+
47
+
33
48
sil @cl : $@convention(thin) () -> Int
34
49
35
50
// CHECK-LABEL: sil [ossa] @thick_to_thin :
@@ -64,6 +79,7 @@ sil_vtable Bar {
64
79
}
65
80
66
81
sil @createit : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@thick τ_0_0.Type, Int) -> @out τ_0_0
82
+ sil @create2 : $@convention(thin) <τ_0_0 where τ_0_0 : Q> (Int) -> @out τ_0_0
67
83
sil @useGenS : $@convention(thin) <τ_0_0 where τ_0_0 : P> (GenS<τ_0_0>) -> ()
68
84
sil @returnGenS : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@thick τ_0_0.Type) -> GenS<τ_0_0>
69
85
@@ -128,6 +144,22 @@ bb0(%0 : $Int):
128
144
return %11
129
145
}
130
146
147
+ // TODO: we don't support dependent existential archetypes, yet. Once we do, change this test case.
148
+ // CHECK-LABEL: sil [ossa] @dont_replace_dependent_archetype :
149
+ // CHECK: apply %{{[0-9]+}}<(@opened
150
+ // CHECK: } // end sil function 'dont_replace_dependent_archetype'
151
+ sil [ossa] @dont_replace_dependent_archetype : $@convention(thin) (Int) -> @out any Q {
152
+ bb0(%0 : $*any Q, %1 : $Int):
153
+ %2 = metatype $@thick S2.Type
154
+ %3 = init_existential_metatype %2, $@thick any P2.Type
155
+ %4 = open_existential_metatype %3 to $@thick (@opened("0FC03D78-E9DB-11EF-B47C-0EA13E3AABB4", any P2) Self).Type
156
+ %6 = function_ref @create2 : $@convention(thin) <τ_0_0 where τ_0_0 : Q> (Int) -> @out τ_0_0
157
+ %7 = init_existential_addr %0, $(@opened("0FC03D78-E9DB-11EF-B47C-0EA13E3AABB4", any P2) Self).A
158
+ %8 = apply %6<(@opened("0FC03D78-E9DB-11EF-B47C-0EA13E3AABB4", any P2) Self).A>(%7, %1) : $@convention(thin) <τ_0_0 where τ_0_0 : Q> (Int) -> @out τ_0_0
159
+ %11 = tuple ()
160
+ return %11
161
+ }
162
+
131
163
// CHECK-LABEL: sil [ossa] @dont_replace_returned_embedded_archetype :
132
164
// CHECK: apply %{{[0-9]+}}<@opened
133
165
// CHECK: } // end sil function 'dont_replace_returned_embedded_archetype'
0 commit comments