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;
|
return;
|
||||||
|
|
||||||
/// is this nominal specifically an 'actor' or 'distributed actor'?
|
/// is this nominal specifically an 'actor' or 'distributed actor'?
|
||||||
bool actorClass = false;
|
bool anyActorClass = false;
|
||||||
bool distributedActorClass = false;
|
|
||||||
if (auto klass = dyn_cast<ClassDecl>(nominal)) {
|
if (auto klass = dyn_cast<ClassDecl>(nominal)) {
|
||||||
actorClass = klass->isActor();
|
anyActorClass = klass->isAnyActor();
|
||||||
distributedActorClass = klass->isDistributedActor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SmallPtrSet<ProtocolDecl *, 16> handledProtocols;
|
SmallPtrSet<ProtocolDecl *, 16> handledProtocols;
|
||||||
@@ -729,12 +727,11 @@ public:
|
|||||||
// There is a special restriction on the Actor protocol in that
|
// There is a special restriction on the Actor protocol in that
|
||||||
// it is only valid to conform to Actor on an 'actor' decl,
|
// it is only valid to conform to Actor on an 'actor' decl,
|
||||||
// not extensions of that 'actor'.
|
// not extensions of that 'actor'.
|
||||||
if (actorClass &&
|
if (anyActorClass) {
|
||||||
inherited->isSpecificProtocol(KnownProtocolKind::Actor))
|
if (inherited->isSpecificProtocol(KnownProtocolKind::Actor) ||
|
||||||
return TypeWalker::Action::SkipNode;
|
inherited->isSpecificProtocol(KnownProtocolKind::DistributedActor))
|
||||||
if (distributedActorClass &&
|
return TypeWalker::Action::SkipNode;
|
||||||
inherited->isSpecificProtocol(KnownProtocolKind::DistributedActor))
|
}
|
||||||
return TypeWalker::Action::SkipNode;
|
|
||||||
|
|
||||||
// Do not synthesize an extension to print a conformance to an
|
// Do not synthesize an extension to print a conformance to an
|
||||||
// invertible protocol, as their conformances are always re-inferred
|
// 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-emit-module-interface(%t/TestResilient.swiftinterface) %s -module-name TestResilient
|
||||||
// RUN: %target-swift-typecheck-module-from-interface(%t/TestResilient.swiftinterface) -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: %FileCheck %s < %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
|
|
||||||
|
|
||||||
import Distributed
|
import Distributed
|
||||||
|
|
||||||
@@ -23,4 +20,4 @@ public distributed actor DistributedExample {
|
|||||||
|
|
||||||
// CHECK: distributed public 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