File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -2210,7 +2210,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
2210
2210
2211
2211
CanType resultInstanceTy = OEI->getType ().getSwiftRValueType ();
2212
2212
2213
- require (OEI->getType ().isAddress (),
2213
+ require (OEI->getType ().isAddress () || !fnConv. useLoweredAddresses () ,
2214
2214
" open_existential_box result must be an address" );
2215
2215
2216
2216
auto archetype = getOpenedArchetypeOf (resultInstanceTy);
Original file line number Diff line number Diff line change @@ -325,3 +325,18 @@ func s200______use_foo_var() {
325
325
func s210______compErasure( _ x: Foo & Error ) -> Error {
326
326
return x
327
327
}
328
+
329
+ // Tests that existential boxes can contain opaque types
330
+ // ---
331
+ // CHECK-LABEL: sil hidden @_T020opaque_values_silgen21s220_____openExistBoxSSs5Error_pF : $@convention(thin) (@owned Error) -> @owned String {
332
+ // CHECK: bb0([[ARG:%.*]] : $Error):
333
+ // CHECK: [[BORROWED_ARG:%.*]] = begin_borrow [[ARG]]
334
+ // CHECK: [[OPAQUE_ARG:%.*]] = open_existential_box [[BORROWED_ARG]] : $Error to $@opened({{.*}}) Error
335
+ // CHECK: [[RET_STRING:%.*]] = apply{{.*}}<@opened({{.*}}) Error>([[OPAQUE_ARG]]) : $@convention(witness_method) <τ_0_0 where τ_0_0 : Error> (@in_guaranteed τ_0_0) -> @owned String
336
+ // CHECK: end_borrow [[BORROWED_ARG]] from [[ARG]]
337
+ // CHECK: destroy_value [[ARG]] : $Error
338
+ // CHECK: return [[RET_STRING]] : $String
339
+ // CHECK-LABEL: } // end sil function '_T020opaque_values_silgen21s220_____openExistBoxSSs5Error_pF'
340
+ func s220_____openExistBox( _ x: Error ) -> String {
341
+ return x. _domain
342
+ }
You can’t perform that action at this time.
0 commit comments