Skip to content

Eliminate unnecessary restriction for unownedExecutor to main actor definition #40682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -4431,9 +4431,6 @@ ERROR(distributed_actor_protocol_illegal_inheritance,none,
ERROR(broken_distributed_actor_requirement,none,
"DistributedActor protocol is broken: unexpected requirement", ())

ERROR(unowned_executor_outside_actor,none,
"'unownedExecutor' can only be implemented within the main "
"definition of an actor", ())
ERROR(override_implicit_unowned_executor,none,
"cannot override an actor's 'unownedExecutor' property that wasn't "
"explicitly defined", ())
Expand Down
13 changes: 0 additions & 13 deletions lib/Sema/TypeCheckProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4924,19 +4924,6 @@ void ConformanceChecker::resolveValueWitnesses() {
if (checkActorIsolation(requirement, witness))
return;

// Ensure that Actor.unownedExecutor is implemented within the
// actor class itself. But if this somehow resolves to the
// requirement, ignore it.
if (requirement->getName().isSimpleName(C.Id_unownedExecutor) &&
Proto->isSpecificProtocol(KnownProtocolKind::Actor) &&
DC != witness->getDeclContext() &&
!isa<ProtocolDecl>(witness->getDeclContext()) &&
Adoptee->getClassOrBoundGenericClass() &&
Adoptee->getClassOrBoundGenericClass()->isActor()) {
witness->diagnose(diag::unowned_executor_outside_actor);
return;
}

// Objective-C checking for @objc requirements.
if (requirement->isObjC() &&
requirement->getName() == witness->getName() &&
Expand Down