mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Distributed] Only synthesize Codable for DA where the ID is Codable (#72081)
This commit is contained in:
committed by
GitHub
parent
8bfe9d0395
commit
b7ff16baf7
@@ -1043,3 +1043,29 @@ NormalProtocolConformance *GetDistributedActorImplicitCodableRequest::evaluate(
|
||||
return addDistributedActorCodableConformance(classDecl,
|
||||
C.getProtocol(protoKind));
|
||||
}
|
||||
|
||||
bool CanSynthesizeDistributedActorCodableConformanceRequest::evaluate(
|
||||
Evaluator &evaluator, NominalTypeDecl *actor) const {
|
||||
|
||||
if (actor && !isa<ClassDecl>(actor))
|
||||
return false;
|
||||
|
||||
if (!actor->isDistributedActor())
|
||||
return false;
|
||||
|
||||
auto systemTy = getConcreteReplacementForProtocolActorSystemType(actor);
|
||||
if (!systemTy)
|
||||
return false;
|
||||
|
||||
if (!systemTy->getAnyNominal())
|
||||
return false;
|
||||
|
||||
auto idTy = getDistributedActorSystemActorIDType(systemTy->getAnyNominal());
|
||||
if (!idTy)
|
||||
return false;
|
||||
|
||||
return TypeChecker::conformsToKnownProtocol(
|
||||
idTy, KnownProtocolKind::Decodable, actor->getParentModule()) &&
|
||||
TypeChecker::conformsToKnownProtocol(
|
||||
idTy, KnownProtocolKind::Encodable, actor->getParentModule());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user