Skip to content

Fix @isolated(any) for distributed actors #72035

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

Conversation

rjmccall
Copy link
Contributor

@rjmccall rjmccall commented Mar 2, 2024

No description provided.

@rjmccall
Copy link
Contributor Author

rjmccall commented Mar 2, 2024

@swift-ci Please test

Copy link
Contributor

@ktoso ktoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

distributed actor DA {
distributed func testDistributedIsolation() {
takeInheritingAsyncIsolatedAny {
await self.asyncAction()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@rjmccall rjmccall force-pushed the fix-distributed-actor-isolated-any branch from 69c25ad to b73efae Compare March 2, 2024 20:53
@rjmccall
Copy link
Contributor Author

rjmccall commented Mar 2, 2024

@swift-ci Please test

@glessard
Copy link
Contributor

glessard commented Mar 3, 2024

@swift-ci please test macOS platform

@ktoso ktoso added the distributed Feature → concurrency: distributed actor label Mar 4, 2024
First, and I really should've checked this, but global actors do not
require `shared` to return `Self`; adjust the logic to propagate the
right formal type to the erasure logic.

Second, handle attempts to erase the isolation of something isolated to
a distributed actor using the magic Actor conformance that Doug added.
This only works when the actor is local, but it shouldn't be difficult to
enforce that we only attempt to erase isolation what that's true --- we
need to prevent partial application of distributed actors, and we need to
disallow explicit isolated captures of distributed actors when we're not
currently isolated to it.  Otherwise, it's not possible to get an
@isolated(any) function value with an isolation that isn't the current
function's isolation, which means it always has to be local.

Fixed rdar://123734019
@rjmccall rjmccall force-pushed the fix-distributed-actor-isolated-any branch from b73efae to 43b9b28 Compare March 4, 2024 09:15
@rjmccall
Copy link
Contributor Author

rjmccall commented Mar 4, 2024

@swift-ci Please test

@rjmccall rjmccall merged commit c64b062 into swiftlang:main Mar 4, 2024
@rjmccall rjmccall deleted the fix-distributed-actor-isolated-any branch March 4, 2024 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distributed Feature → concurrency: distributed actor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants