Skip to content

Commit 870c712

Browse files
ktosoxedin
authored andcommitted
fix protocols
1 parent 79ad927 commit 870c712

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/AST/DistributedDecl.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ Type swift::getConcreteReplacementForProtocolActorSystemType(ValueDecl *member)
9797
}
9898

9999
Type swift::getDistributedActorSystemType(NominalTypeDecl *actor) {
100+
assert(!dyn_cast<ProtocolDecl>(actor) &&
101+
"Use getConcreteReplacementForProtocolActorSystemType instead to get"
102+
"the concrete ActorSystem, if bound, for this DistributedActor "
103+
"constrained ProtocolDecl!");
100104
assert(actor->isDistributedActor());
101105
auto &C = actor->getASTContext();
102106

lib/SIL/IR/SILFunctionBuilder.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,10 @@ void SILFunctionBuilder::addFunctionAttributes(
226226
fprintf(stderr, "[%s:%d] (%s) IS DIST THUNK!\n", __FILE__, __LINE__, __FUNCTION__);
227227
constant.dump();
228228

229-
// TODO: also handle protocol / extension
230-
auto actor = dyn_cast<ClassDecl>(decl->getDeclContext());
229+
auto *actor = decl->getDeclContext()->getSelfNominalTypeDecl();
231230
if (actor && actor->isDistributedActor()) {
232231
auto &C = decl->getASTContext();
233-
auto systemTy = getDistributedActorSystemType(actor);
232+
auto systemTy = getConcreteReplacementForProtocolActorSystemType(decl);
234233
assert(systemTy);
235234

236235
auto decoderTy =

0 commit comments

Comments
 (0)