Skip to content

Commit 18db5af

Browse files
committed
[Distributed] fix how we locate the system property;
1 parent e6a1e23 commit 18db5af

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

lib/Sema/CodeSynthesisDistributedActor.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,19 @@ VarDecl *GetDistributedActorSystemPropertyRequest::evaluate(
145145
if (!C.getLoadedModule(C.Id_Distributed))
146146
return nullptr;
147147

148-
149-
if (auto system = actor->lookupDirect(C.Id_actorSystem).begin()) {
150-
// TODO(distributed): may need to check conformance here?
151-
return dyn_cast<VarDecl>(*system);
148+
auto module = C.getStdlibModule();
149+
auto DistSystemProtocol =
150+
C.getProtocol(KnownProtocolKind::DistributedActorSystem);
151+
152+
for (auto system : actor->lookupDirect(C.Id_actorSystem)) {
153+
if (auto var = dyn_cast<VarDecl>(system)) {
154+
auto conformance = module->conformsToProtocol(var->getInterfaceType(),
155+
DistSystemProtocol);
156+
if (conformance.isInvalid())
157+
continue;
158+
159+
return var;
160+
}
152161
}
153162

154163
return nullptr;

0 commit comments

Comments
 (0)