Skip to content

[6.2][TypeChecker] Allow closures to assume nonisolated(nonsending) #80924

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 3 commits into from
Apr 21, 2025

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Apr 18, 2025

Cherry-pick of #80872


  • Explanation:

    Fixes a bug where closures passed to nonisolated(nonsending) parameter would hop
    to a wrong isolation context.

    Always infer nonisolated(nonsending) from context directly on a closure unless the
    closure is marked as @concurrent, otherwise the closure is not going to get correct
    isolation and going to hop to the wrong executor in its preamble.

  • Main Branch PR: [TypeChecker] Allow closures to assume nonisolated(nonsending) #80872

  • Risk: Low (No source compatibility impact since it only applies to APIs that would have adopted the specifier explicitly).

  • Reviewed By: @ktoso @hborla

  • Resolves: rdar://149107104

  • Testing: Added new tests to the test suite.

xedin and others added 3 commits April 18, 2025 16:41
Always infer `nonisolated(nonsending)` from context directly on
a closure unless the closure is marked as `@concurrent`, otherwise
the closure is not going to get correct isolation and going to hop
to the wrong executor in its preamble.

Resolves: rdar://149107104
(cherry picked from commit 3de72c5)
…t actor

Closures that are caller isolated used to still hop to the generic
executor, which is incorrect.

(cherry picked from commit bb62e96)
@xedin xedin added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.2 labels Apr 18, 2025
@xedin xedin requested a review from hborla April 18, 2025 23:50
@xedin xedin requested a review from a team as a code owner April 18, 2025 23:50
@xedin
Copy link
Contributor Author

xedin commented Apr 18, 2025

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Apr 19, 2025

@swift-ci please test Windows platform

@xedin xedin merged commit cdc02a4 into swiftlang:release/6.2 Apr 21, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 6.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants