Skip to content

[SwiftParser] SE-0478: Implement using declaration under an experim… #3087

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 1 commit into from
Jun 2, 2025

Conversation

xedin
Copy link
Contributor

@xedin xedin commented May 30, 2025

…ental feature

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.

@xedin
Copy link
Contributor Author

xedin commented May 30, 2025

swiftlang/swift#81863
@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented May 30, 2025

swiftlang/swift#81863
@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented May 30, 2025

swiftlang/swift#81863
@swift-ci please test Windows platform

Comment on lines 472 to 485
precondition(attrs.attributes.isEmpty)
precondition(attrs.modifiers.isEmpty)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think we necessarily need to crash the parser if attrs.attributes or attrs.modifiers is not empty. instead, we can shove them into unexpectedBeforeUsingKeyword. If for some reason they end up being non-nil that gives the user a better diagnostic that they can go off (plus doesn’t crash source tooling).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can look into that, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thank you.

…ental feature

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.
@xedin
Copy link
Contributor Author

xedin commented Jun 2, 2025

swiftlang/swift#81863
@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Jun 2, 2025

swiftlang/swift#81863
@swift-ci please test Windows platform

@xedin xedin merged commit 6de157b into swiftlang:main Jun 2, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants