@@ -33,32 +33,20 @@ using namespace swift;
33
33
34
34
bool IsDistributedActorRequest::evaluate(
35
35
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`.
37
37
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));
53
42
}
54
43
55
44
// 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)
57
47
return false;
58
48
59
- auto distributedAttr = nominal->getAttrs()
60
- .getAttribute<DistributedActorAttr>();
61
- return distributedAttr != nullptr;
49
+ return classDecl->isExplicitDistributedActor();
62
50
}
63
51
64
52
bool IsDistributedFuncRequest::evaluate(
0 commit comments