-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Actors] Permit non-sendable, escaping closures to be actor-isolated. #36698
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
[Actors] Permit non-sendable, escaping closures to be actor-isolated. #36698
Conversation
Remove the heuristic that escaping closures cannot be actor-isolated. This is in line with the long term plan for actor isolation, but opens up some holes in the short term because Sendable closures are not enforced throughout the Swift ecosystem. One significant effect of this change is that we will now, statically, fail to detect many cases where actor isolation can be broken.
@swift-ci please smoke test |
|
||
// CHECK: acceptEscapingAsyncClosure | ||
// CHECK: closure_expr | ||
// CHECK-NOT:actor-isolated | ||
acceptEscapingAsyncClosure { () async in print("hello") } | ||
// CHEC:actor-isolated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
// CHEC:actor-isolated | |
// CHECK:actor-isolated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunate without Sendable checking but LGTM.
You have one typo in the tests which means it won't check one of the properties :-)
@swift-ci please smoke test macOS |
@swift-ci please smoke test |
@swift-ci please smoke test Linux |
@swift-ci please smoke test |
@swift-ci please smoke test macOS |
Remove the heuristic that escaping closures cannot be actor-isolated.
This is in line with the long term plan for actor isolation, but opens
up some holes in the short term because Sendable closures are not enforced
throughout the Swift ecosystem.
One significant effect of this change is that we will now, statically,
fail to detect many cases where actor isolation can be broken.