Skip to content

Commit 1d7f2ee

Browse files
committed
[Distributed] review feedback: avoid un-necessary handling null id; it will always be synthesized or present already
1 parent 78d8224 commit 1d7f2ee

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

lib/Sema/DerivedConformanceDistributedActor.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,6 @@ static FuncDecl *deriveDistributedActorSystem_invokeHandlerOnReturn(
426426
/******************************* PROPERTIES ***********************************/
427427
/******************************************************************************/
428428

429-
// TODO(distributed): make use of this after all, but FORCE it?
430429
static ValueDecl *deriveDistributedActor_id(DerivedConformance &derived) {
431430
assert(derived.Nominal->isDistributedActor());
432431
auto &C = derived.Context;
@@ -480,17 +479,12 @@ static ValueDecl *deriveDistributedActor_actorSystem(
480479
// `actorSystem` MUST be the second field, because for a remote instance
481480
// we don't allocate memory after those two fields, so their order is very
482481
// important. The `hint` below makes sure the system is inserted right after.
483-
if (auto id = derived.Nominal->getDistributedActorIDProperty()) {
484-
derived.addMemberToConformanceContext(pbDecl, /*hint=*/id);
485-
derived.addMemberToConformanceContext(propDecl, /*hint=*/id);
486-
} else {
487-
// `id` will be synthesized next, and will insert at head,
488-
// so in order for system to be SECOND (as it must be),
489-
// we'll insert at head right now and as id gets synthesized we'll get
490-
// the correct order: id, actorSystem.
491-
derived.addMemberToConformanceContext(pbDecl, /*insertAtHead==*/true);
492-
derived.addMemberToConformanceContext(propDecl, /*insertAtHead=*/true);
493-
}
482+
auto id = derived.Nominal->getDistributedActorIDProperty();
483+
assert(id && "id must be synthesized first, so it is the first field of any "
484+
"distributed actor (followed by actorSystem)");
485+
486+
derived.addMemberToConformanceContext(pbDecl, /*hint=*/id);
487+
derived.addMemberToConformanceContext(propDecl, /*hint=*/id);
494488

495489
return propDecl;
496490
}

0 commit comments

Comments
 (0)