[Distributed] Avoid redundant conformance to DistributedActor in interface files

Forgetting to handle DistributedActor next to Actor strikes again:
Actors are special that their conformance is implicit and needs not be
printed in swift interface files.

an actor's Actor conformance was filtered out, however the same logic
needs to be applied to DistributedActor, as otherwise there can be
redundant conformance errors when validating module interface files.

Resolves rdar://160252579
This commit is contained in:
Konrad Malawski
2025-09-19 09:01:23 +09:00
parent d8393c4bc9
commit d73b907d66
3 changed files with 36 additions and 4 deletions

View File

@@ -688,10 +688,13 @@ public:
if (!printOptions.shouldPrint(nominal))
return;
/// is this nominal specifically an 'actor'?
/// is this nominal specifically an 'actor' or 'distributed actor'?
bool actorClass = false;
if (auto klass = dyn_cast<ClassDecl>(nominal))
bool distributedActorClass = false;
if (auto klass = dyn_cast<ClassDecl>(nominal)) {
actorClass = klass->isActor();
distributedActorClass = klass->isDistributedActor();
}
SmallPtrSet<ProtocolDecl *, 16> handledProtocols;
@@ -727,7 +730,10 @@ public:
// it is only valid to conform to Actor on an 'actor' decl,
// not extensions of that 'actor'.
if (actorClass &&
inherited->isSpecificProtocol(KnownProtocolKind::Actor))
inherited->isSpecificProtocol(KnownProtocolKind::Actor))
return TypeWalker::Action::SkipNode;
if (distributedActorClass &&
inherited->isSpecificProtocol(KnownProtocolKind::DistributedActor))
return TypeWalker::Action::SkipNode;
// Do not synthesize an extension to print a conformance to an