File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -3023,14 +3023,17 @@ _bridgeNonVerbatimFromObjectiveC(
3023
3023
const_cast <void *>(swift_dynamicCastUnknownClass (sourceValue,
3024
3024
objectiveCType));
3025
3025
3026
- if (sourceValueAsObjectiveCType) {
3027
- // The type matches. _forceBridgeFromObjectiveC returns `Self`, so
3028
- // we can just return it directly.
3029
- bridgeWitness->forceBridgeFromObjectiveC (
3030
- static_cast <HeapObject*>(sourceValueAsObjectiveCType),
3031
- destValue, nativeType, nativeType, bridgeWitness);
3032
- return ;
3026
+ if (!sourceValueAsObjectiveCType) {
3027
+ swift::swift_dynamicCastFailure (_swift_getClass (sourceValue),
3028
+ objectiveCType);
3033
3029
}
3030
+
3031
+ // The type matches. _forceBridgeFromObjectiveC returns `Self`, so
3032
+ // we can just return it directly.
3033
+ bridgeWitness->forceBridgeFromObjectiveC (
3034
+ static_cast <HeapObject*>(sourceValueAsObjectiveCType),
3035
+ destValue, nativeType, nativeType, bridgeWitness);
3036
+ return ;
3034
3037
}
3035
3038
3036
3039
// Fail.
You can’t perform that action at this time.
0 commit comments