File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -874,7 +874,7 @@ namespace {
874
874
}
875
875
auto targetFormalTy = target.FormalType ;
876
876
auto targetLoweredTy =
877
- SILType::getPrimitiveObjectType (targetFormalTy );
877
+ SILType::getPrimitiveObjectType (target. LoweredType . getASTType () );
878
878
if (isCFBridgingConversion (SwiftModule,
879
879
source.FormalType ,
880
880
targetFormalTy)) {
Original file line number Diff line number Diff line change @@ -1046,3 +1046,28 @@ bb0(%0 : $@thin T.Type):
1046
1046
%1 = builtin "isConcrete"(%0 : $@thin T.Type) : $Builtin.Int1
1047
1047
return %1 : $Builtin.Int1
1048
1048
}
1049
+
1050
+ class AClass {}
1051
+ class BClass : AClass {}
1052
+
1053
+ // CHECK-LABEL: sil @test_checked_cast_br_thick_class_type
1054
+ // CHECK: [[METATYPE:%.*]] = metatype $@thick BClass.Type
1055
+ // CHECK: [[SUPER:%.*]] = upcast [[METATYPE]] : $@thick BClass.Type to $@thick AClass.Type
1056
+ // CHECK: br bb1([[SUPER]] : $@thick AClass.Type)
1057
+ sil @test_checked_cast_br_thick_class_type : $@convention(thin) (@thin P.Protocol) -> Builtin.Int1 {
1058
+ bb0(%0 : $@thin P.Protocol):
1059
+ %2 = metatype $@thick BClass.Type
1060
+ checked_cast_br %2 : $@thick BClass.Type to AClass.Type, bb1, bb2
1061
+
1062
+ bb1(%5 : $@thick AClass.Type):
1063
+ debug_value %5 : $@thick AClass.Type, let, name "type"
1064
+ %6 = integer_literal $Builtin.Int1, -1
1065
+ br bb3(%6 : $Builtin.Int1)
1066
+
1067
+ bb2:
1068
+ %9 = integer_literal $Builtin.Int1, 0
1069
+ br bb3(%9 : $Builtin.Int1)
1070
+
1071
+ bb3(%11 : $Builtin.Int1):
1072
+ return %11 : $Builtin.Int1
1073
+ }
You can’t perform that action at this time.
0 commit comments