Skip to content
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

[SR-6852] Support #if swift(<4.1) #49401

belkadan opened this issue Jan 26, 2018 · 1 comment

[SR-6852] Support #if swift(<4.1) #49401

belkadan opened this issue Jan 26, 2018 · 1 comment


Copy link

@belkadan belkadan commented Jan 26, 2018

Previous ID SR-6852
Radar None
Original Reporter @belkadan
Type Improvement
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 2
Component/s Compiler
Labels Improvement, StarterBug, StarterProposal
Assignee hashemi (JIRA)
Priority Medium

md5: d6504962ca1a564793f5327cd6c0afb5

Issue Description:

swift(>=x.y) is a special compilation condition that controls whether part of a file is even parsed, because the language may change between versions. Because of this, there's a restriction that it can't be combined with other compilation conditions, which still check that the inactive block of the #if parses correctly. However, there's nothing wrong with `#if !swift(>=4.1)`, and therefore it would be reasonable to support spelling that directly, `#if swift(<4.1)`.

(Note that it would not make sense to check for swift(>x.y) or swift(<=x.y), since that makes a statement about future releases rather than present releases. For example, even when 4.1.0 is officially released, that wouldn't preclude another release from the 4.0 branch, 4.0.4.)

Copy link

@swift-ci swift-ci commented Feb 9, 2018

Comment by Ahmad Alhashemi (JIRA)

Submitted an implementation in PR-14503

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants