@@ -3392,3 +3392,40 @@ bb3(%16 : $Int32): // Preds: bb1 bb2
3392
3392
return %16 : $Int32 // id: %17
3393
3393
}
3394
3394
3395
+ protocol Prot0 : class {
3396
+ static func newWithConfig() throws -> Builtin.Int32
3397
+ }
3398
+
3399
+
3400
+ protocol Prot1 : Prot0 {
3401
+ static func newWithConfig() throws -> Builtin.Int32
3402
+ }
3403
+
3404
+ protocol Prot2 : Prot1 {
3405
+ static func newWithConfig() throws -> Builtin.Int32
3406
+ }
3407
+
3408
+ sil @getMetaType : $@convention(thin) () -> @thick Prot2.Type
3409
+
3410
+ // CHECK-LABEL: meta_existential
3411
+ // CHECK:bb0:
3412
+ // CHECK: [[APPLY:%.*]] = apply {{%.*}}() : $@convention(thin) () -> @thick Prot2.Type
3413
+ // CHECK: [[OE:%.*]] = open_existential_metatype [[APPLY]] : $@thick Prot2.Type to $@thick (@opened("690DA5F6-B5EA-11E7-B144-685B3593C496") Prot1).Type
3414
+ // CHECK: [[WM:%.*]] = witness_method $@opened("690DA5F6-B5EA-11E7-B144-685B3593C496") Prot1, #Prot1.newWithConfig!1 : <Self where Self : Prot1> (Self.Type) -> () throws -> Builtin.Int32, [[OE]] : $@thick (@opened("690DA5F6-B5EA-11E7-B144-685B3593C496") Prot1).Type : $@convention(witness_method) <τ_0_0 where τ_0_0 : Prot1> (@thick τ_0_0.Type) -> (Builtin.Int32, @error MyErrorType)
3415
+ // CHECK: try_apply [[WM]]<@opened("690DA5F6-B5EA-11E7-B144-685B3593C496") Prot1>([[OE]]) : $@convention(witness_method) <τ_0_0 where τ_0_0 : Prot1> (@thick τ_0_0.Type) -> (Builtin.Int32, @error MyErrorType)
3416
+ sil @meta_existential : $@convention(thin) () -> (Builtin.Int32, @error MyErrorType) {
3417
+ bb0:
3418
+ %fref = function_ref @getMetaType : $@convention(thin) () -> @thick Prot2.Type
3419
+ %apply = apply %fref() : $@convention(thin) () -> @thick Prot2.Type
3420
+ %open = open_existential_metatype %apply : $@thick Prot2.Type to $@thick (@opened("690DA5F6-B5EA-11E7-B144-685B3593C496") Prot1).Type
3421
+ %1 = init_existential_metatype %open : $@thick (@opened("690DA5F6-B5EA-11E7-B144-685B3593C496") Prot1).Type, $@thick Prot1.Type
3422
+ %2 = open_existential_metatype %1 : $@thick Prot1.Type to $@thick (@opened("92105EE0-DCB0-11E5-865D-C8E0EB309913") Prot1).Type
3423
+ %3 = witness_method $@opened("92105EE0-DCB0-11E5-865D-C8E0EB309913") Prot1, #Prot1.newWithConfig!1, %2 : $@thick (@opened("92105EE0-DCB0-11E5-865D-C8E0EB309913") Prot1).Type : $@convention(witness_method) <τ_0_0 where τ_0_0 : Prot1> (@thick τ_0_0.Type) -> (Builtin.Int32, @error MyErrorType)
3424
+ try_apply %3<@opened("92105EE0-DCB0-11E5-865D-C8E0EB309913") Prot1>(%2) : $@convention(witness_method) <τ_0_0 where τ_0_0 : Prot1> (@thick τ_0_0.Type) -> (Builtin.Int32, @error MyErrorType), normal bb1, error bb2
3425
+
3426
+ bb1(%4 : $Builtin.Int32):
3427
+ return %4 : $Builtin.Int32
3428
+
3429
+ bb2(%5 : $MyErrorType):
3430
+ throw %5 : $MyErrorType
3431
+ }
0 commit comments