Skip to content

[6.2][Sema/stdlib] SE-0472: implement @_inheritActorContext(always) and adopt it in Task.immediate APIs #81645

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

Open
wants to merge 3 commits into
base: release/6.2
Choose a base branch
from

Conversation

xedin
Copy link
Contributor

@xedin xedin commented May 20, 2025

Cherry-pick of #81496, #81543, #81572


xedin added 3 commits May 20, 2025 10:29
- Extend `@_inheritActorContext` attribute to support optional `always` modifier.
  The new modifier will make closure context isolated even if the parameter is not
  captured by the closure.
- Implementation `@_inheritActorContext` attribute validation - it could only be
  used on parameter that have `@Sendable` or `sending` and `@isolated(any)` or
  `async` function type (downgraded to a warning until future major Swift mode
  to avoid source compatibility issues).
- Add a new language feature that guards use of `@_inheritActorContext(always)` in swift interface files
- Update `getLoweredLocalCaptures` to add an entry for isolation parameter implicitly captured by `@_inheritActorContext(always)`
- Update serialization code to store `always` modifier

(cherry picked from commit 04d4676)
(cherry picked from commit c050e8f)
(cherry picked from commit c0aca53)
(cherry picked from commit a4f6d71)
(cherry picked from commit 6c911f5)
(cherry picked from commit 17b8f7e)
…tanceCapture` for parameters

SILGen expects actor instance isolation to always come from captures,
we need to maintain that with implicit isolation capture performed by
`@_inheritActorContext(always)`.

(cherry picked from commit 9104744)
This change aligns implementation with the current SE-0472 proposal.

(cherry picked from commit c3c1b4f)
(cherry picked from commit 8c05636)
(cherry picked from commit 0598b8c)
@xedin xedin requested a review from hborla May 20, 2025 17:38
@xedin xedin requested a review from a team as a code owner May 20, 2025 17:38
@xedin xedin added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.2 labels May 20, 2025
@xedin
Copy link
Contributor Author

xedin commented May 20, 2025

@swift-ci please test

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.

1 participant