Skip to content

[6.2][AST/Sema] SE-0478: Implement using declaration under an experimental flag #81997

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

xedin
Copy link
Contributor

@xedin xedin commented Jun 4, 2025

Cherry-pick of #81863


  • Explanation:

    This is an alternative spelling of typealias DefaultIsolation = (MainActor | nonisolated) that was proposed as part of SE-0478.

    using declaration accepts an attribute or a modifier and currently could be used to set a default actor isolation per file, but could be extended to support other use-cases in the future.

    Implementation uses DefaultIsolationPerFile experimental feature flag to hide the syntax.

  • Resolves: rdar://152598259

  • Main Branch PR: [AST/Sema] SE-0478: Implement using declaration under an experimental flag #81863

  • Risk: Low. This is a new feature under an experimental flag which isn't enabled by default and currently has no adopters.

  • Reviewed By: @hamishknight @ktoso

  • Testing: Added new test-cases to the test suite.

xedin added 14 commits June 4, 2025 13:16
Initially this declaration is going to be used to determine
per-file default actor isolation i.e. `using @MainActor` and
`using nonisolated` but it could be extended to support other
file-global settings in the future.

(cherry picked from commit aabfebe)
…f `.swift`

These are split-file C++ tests, this is a problem for swift-syntax
because `.swift` tests get parsed for round-trip testing if
swift-syntax is located near swift.

(cherry picked from commit c019b66)
The default isolation is computed based on `using` declaration
found in the file, if any.

(cherry picked from commit 36b7711)
These declarations are effectively `fileprivate` at the moment
and should appear in swift interfaces.

(cherry picked from commit ad71e07)
…experimental feature

(cherry picked from commit c246a7a)
Infer default actor isolation from `using` declaration in the
file scope and use it to override one that is set by `-default-isolation`
flag.

(cherry picked from commit 595c3b3)
@xedin
Copy link
Contributor Author

xedin commented Jun 4, 2025

swiftlang/swift-syntax#3093
@swift-ci please test

@xedin xedin merged commit 608a37a into swiftlang:release/6.2 Jun 5, 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.

2 participants