Skip to content

[6.2][Concurrency] Fix nonisolated(nonsending) interaction with #isolation #82826

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

Conversation

ktoso
Copy link
Contributor

@ktoso ktoso commented Jul 7, 2025

Description: The #isolation did not work correctly with nonisolated(nonsending), as that would add an implicit isolated parameter in SIL, yet the macro was only considering the AST parameters. This made it impossible to treat nonisolated(nonsending) as a "true" replacement for passing isolated (any Actor)? = #isolation to methods, because we'd not be able to "carry forward" the #isolation inside method bodies.

Scope/Impact: This affects users moving to nonisolated(nonsending) from passing explicit isolated parameters, and allows them to correctly "stay on" the caller as long as they want.
Risk: Low, this only corrects the macro expansion in SIL specifically for nonisolated(nonsending) methods.
Testing: CI testing, added runtime and SIL test.
Reviewed by: @DougGregor

Original PR: #82793
Radar: rdar://155003540

@ktoso ktoso requested a review from a team as a code owner July 7, 2025 03:12
@ktoso
Copy link
Contributor Author

ktoso commented Jul 7, 2025

@swift-ci please test

@ktoso ktoso added concurrency Feature: umbrella label for concurrency language features 🍒 release cherry pick Flag: Release branch cherry picks labels Jul 7, 2025
Copy link
Contributor Author

@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.

One comment fix up

@ktoso
Copy link
Contributor Author

ktoso commented Jul 7, 2025

@swift-ci please test

Small cleanup from code review; we'd crash either way after this line,
so might be better to always ASSERT more nicely.
@ktoso
Copy link
Contributor Author

ktoso commented Jul 8, 2025

@swift-ci please test

@ktoso ktoso merged commit 0bf7b29 into swiftlang:release/6.2 Jul 8, 2025
5 checks passed
@ktoso ktoso deleted the pick-wip-correct-isolated-handling-with-caller-isolation branch July 8, 2025 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
concurrency Feature: umbrella label for concurrency language features 🍒 release cherry pick Flag: Release branch cherry picks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants