mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user