mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Simplify the check; conforming to (Distributed)Actor is not right in any case
This commit is contained in:
@@ -689,11 +689,9 @@ public:
|
||||
return;
|
||||
|
||||
/// is this nominal specifically an 'actor' or 'distributed actor'?
|
||||
bool actorClass = false;
|
||||
bool distributedActorClass = false;
|
||||
bool anyActorClass = false;
|
||||
if (auto klass = dyn_cast<ClassDecl>(nominal)) {
|
||||
actorClass = klass->isActor();
|
||||
distributedActorClass = klass->isDistributedActor();
|
||||
anyActorClass = klass->isAnyActor();
|
||||
}
|
||||
|
||||
SmallPtrSet<ProtocolDecl *, 16> handledProtocols;
|
||||
@@ -729,12 +727,11 @@ public:
|
||||
// There is a special restriction on the Actor protocol in that
|
||||
// it is only valid to conform to Actor on an 'actor' decl,
|
||||
// not extensions of that 'actor'.
|
||||
if (actorClass &&
|
||||
inherited->isSpecificProtocol(KnownProtocolKind::Actor))
|
||||
return TypeWalker::Action::SkipNode;
|
||||
if (distributedActorClass &&
|
||||
inherited->isSpecificProtocol(KnownProtocolKind::DistributedActor))
|
||||
return TypeWalker::Action::SkipNode;
|
||||
if (anyActorClass) {
|
||||
if (inherited->isSpecificProtocol(KnownProtocolKind::Actor) ||
|
||||
inherited->isSpecificProtocol(KnownProtocolKind::DistributedActor))
|
||||
return TypeWalker::Action::SkipNode;
|
||||
}
|
||||
|
||||
// Do not synthesize an extension to print a conformance to an
|
||||
// invertible protocol, as their conformances are always re-inferred
|
||||
|
||||
@@ -2,10 +2,7 @@
|
||||
|
||||
// RUN: %target-swift-emit-module-interface(%t/TestResilient.swiftinterface) %s -module-name TestResilient
|
||||
// RUN: %target-swift-typecheck-module-from-interface(%t/TestResilient.swiftinterface) -module-name TestResilient
|
||||
// RUN: %FileCheck %s --dump-input=always < %t/TestResilient.swiftinterface
|
||||
|
||||
// RUN: %target-swift-frontend -compile-module-from-interface -swift-version 5 %t/TestResilient.swiftinterface -o %t/TestResilient.swiftmodule
|
||||
// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules -swift-version 5 -emit-module-interface-path - %t/TestResilient.swiftmodule -module-name TestResilient | %FileCheck %s
|
||||
// RUN: %FileCheck %s < %t/TestResilient.swiftinterface
|
||||
|
||||
import Distributed
|
||||
|
||||
@@ -23,4 +20,4 @@ public distributed actor DistributedExample {
|
||||
|
||||
// CHECK: distributed public actor DistributedExample {
|
||||
|
||||
// CHECK-NOT: extension TestResilient.DistributedExample : Distributed.DistributedActor {}
|
||||
// CHECK-NOT: extension TestResilient.DistributedExample : Distributed.DistributedActor {}
|
||||
|
||||
Reference in New Issue
Block a user