mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
CastOptimizer: handle isolated conformances
Check the isolation of conformances to avoid wrong folding of dynamic casts rdar://147417762
This commit is contained in:
@@ -115,8 +115,12 @@ classifyDynamicCastToProtocol(SILFunction *function, CanType source, CanType tar
|
||||
|
||||
// If checkConformance() returns a valid conformance, then all conditional
|
||||
// requirements were satisfied.
|
||||
if (checkConformance(source, TargetProtocol))
|
||||
if (auto conformance = checkConformance(source, TargetProtocol)) {
|
||||
if (!matchesActorIsolation(conformance, function))
|
||||
return DynamicCastFeasibility::MaySucceed;
|
||||
|
||||
return DynamicCastFeasibility::WillSucceed;
|
||||
}
|
||||
|
||||
auto *SourceNominalTy = source.getAnyNominal();
|
||||
if (!SourceNominalTy)
|
||||
|
||||
Reference in New Issue
Block a user