Skip to content

[SE-0362] Piecemeal adoption of upcoming language improvements #59055

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 4 commits into from
Jul 20, 2022

Conversation

DougGregor
Copy link
Member

@DougGregor DougGregor commented May 24, 2022

Introduce a compiler flag -enable-upcoming-feature X, which can be used to enable a feature in an earlier language mode (e..g, Swift 5.x) that will be enabled by default in an upcoming language mode (e.g., Swift 6). Available features can be detected with #if hasFeature(X).

@DougGregor
Copy link
Member Author

@swift-ci please build toolchain

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please smoke test macOS

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@DougGregor DougGregor marked this pull request as ready for review July 19, 2022 18:17
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

Yay it still works, but I need to address the change from future to upcoming.

Introduce the `-enable-upcoming-feature X` command-line argument to
allow one to opt into features that will be enabled in an upcoming language
mode. Stage in several features this way (`ConciseMagicFile`,
`ForwardTrailingClosures`, `BareSlashRegexLiterals`).
@DougGregor DougGregor changed the title Piecemeal adoption of future language improvements Piecemeal adoption of upcoming language improvements Jul 20, 2022
When we encounter a check like `#if compiler(>=6.0) && something` or
`#if swift(<6.0) || something`, and the left-hand term is a versioning
check that determines the result of the whole condition, then we will
not attempt to validate the right-hand term. This allows us to use
versioned checks along with new discovery features (say, if we add an
`#if attribute(x)`) without having to next conditions.
@DougGregor DougGregor changed the title Piecemeal adoption of upcoming language improvements [SE-0362] Piecemeal adoption of upcoming language improvements Jul 20, 2022
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please test macOS

@DougGregor
Copy link
Member Author

@swift-ci please smoke test macOS

@DougGregor DougGregor merged commit 0fdba62 into swiftlang:main Jul 20, 2022
@DougGregor DougGregor deleted the future-feature branch July 20, 2022 19:26
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.

1 participant