[SE-0470] Prohibit isolated conformances in dynamic casts marked as such

Certain dynamic casts cannot work safely with isolated conformances,
regardless of what executor the code runs on. For such cases, reject
all attempts to conform to the type.
This commit is contained in:
Doug Gregor
2025-03-26 22:29:12 -07:00
parent e0b52cd20e
commit 43df05a89c
8 changed files with 202 additions and 84 deletions

View File

@@ -28,6 +28,7 @@ namespace swift {
class SILType;
class ProtocolDecl;
enum class CastConsumptionKind : unsigned char;
enum class CastingIsolatedConformances: uint8_t;
namespace irgen {
class Address;
@@ -46,7 +47,8 @@ namespace irgen {
Address dest,
CanType toType,
CastConsumptionKind consumptionKind,
CheckedCastMode mode);
CheckedCastMode mode,
CastingIsolatedConformances isolatedConformances);
void emitScalarCheckedCast(IRGenFunction &IGF, Explosion &value,
SILType sourceLoweredType,
@@ -54,6 +56,7 @@ namespace irgen {
SILType targetLoweredType,
CanType targetFormalType,
CheckedCastMode mode,
CastingIsolatedConformances isolatedConformances,
Explosion &out);
llvm::Value *emitFastClassCastIfPossible(