@@ -33,32 +33,20 @@ using namespace swift;
3333
3434bool IsDistributedActorRequest::evaluate (
3535 Evaluator &evaluator, NominalTypeDecl *nominal) const {
36- // Protocols are actors if their `Self` type conforms to `DistributedActor`.
36+ // Protocols are actors if they inherit from `DistributedActor`.
3737 if (auto protocol = dyn_cast<ProtocolDecl>(nominal)) {
38- // Simple case: we have the `DistributedActor` protocol itself.
39- if (protocol->isSpecificProtocol (KnownProtocolKind::DistributedActor))
40- return true ;
41-
42- auto actorProto = nominal->getASTContext ().getProtocol (
43- KnownProtocolKind::DistributedActor);
44- if (!actorProto)
45- return false ;
46-
47- auto selfType = Type (protocol->getProtocolSelfType ());
48- auto genericSig = protocol->getGenericSignature ();
49- if (!genericSig)
50- return false ;
51-
52- return genericSig->requiresProtocol (selfType, actorProto);
38+ auto &ctx = protocol->getASTContext ();
39+ auto *distributedActorProtocol = ctx.getProtocol (KnownProtocolKind::DistributedActor);
40+ return (protocol == distributedActorProtocol ||
41+ protocol->inheritsFrom (distributedActorProtocol));
5342 }
5443
5544 // Class declarations are 'distributed actors' if they are declared with 'distributed actor'
56- if (!dyn_cast<ClassDecl>(nominal))
45+ auto classDecl = dyn_cast<ClassDecl>(nominal);
46+ if (!classDecl)
5747 return false ;
5848
59- auto distributedAttr = nominal->getAttrs ()
60- .getAttribute <DistributedActorAttr>();
61- return distributedAttr != nullptr ;
49+ return classDecl->isExplicitDistributedActor ();
6250}
6351
6452bool IsDistributedFuncRequest::evaluate (
0 commit comments