Skip to content

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

Merged
DougGregor merged 4 commits intoswiftlang:mainfrom
DougGregor:future-feature
Jul 20, 2022
Merged

[SE-0362] Piecemeal adoption of upcoming language improvements#59055
DougGregor merged 4 commits intoswiftlang:mainfrom
DougGregor:future-feature

Conversation

@DougGregor
Copy link
Copy Markdown
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
Copy Markdown
Member Author

@swift-ci please build toolchain

@DougGregor
Copy link
Copy Markdown
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Copy Markdown
Member Author

@swift-ci please smoke test macOS

@DougGregor
Copy link
Copy Markdown
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Copy Markdown
Member Author

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

@swift-ci please smoke test

@DougGregor
Copy link
Copy Markdown
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
Copy Markdown
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Copy Markdown
Member Author

@swift-ci please test macOS

@DougGregor
Copy link
Copy Markdown
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