Skip to content

[Parse] Support #if swift(<4.1) #14503

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

Closed
wants to merge 1 commit into from
Closed

Conversation

hashemi
Copy link
Contributor

@hashemi hashemi commented Feb 9, 2018

Add the ability to specify conditional compilation using < in addition to the currently supported >= unary prefix. #if swift(<4.1) is equivalent to #if !swift(>=4.1).

Resolves #49401.

@xwu
Copy link
Collaborator

xwu commented Feb 9, 2018

@swift-ci Please smoke test

Copy link
Contributor

@jrose-apple jrose-apple left a comment

Choose a reason for hiding this comment

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

Thanks for doing this! Please include some tests that do not come out true, as well as at least one that uses !.

cc @rintaro for any additional comments

@jrose-apple
Copy link
Contributor

@jckarter, @rjmccall, do you think this requires an evolution proposal as well? I tagged the original bug as StarterProposal, but it is a very small change.

@jrose-apple jrose-apple added the swift evolution pending discussion Flag → feature: A feature that has a Swift evolution proposal currently in review label Feb 9, 2018
@@ -28,3 +28,30 @@
asdf asdf asdf asdf
#endif

#if swift(<5)
let a = 1
Copy link
Collaborator

@xwu xwu Feb 9, 2018

Choose a reason for hiding this comment

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

To future-proof these tests, I think the conditions should be such that asdf asdf asdf asdf emits no diagnostics in an #if branch which is never executed--for example, #if swift(<4).

@rjmccall
Copy link
Contributor

rjmccall commented Feb 9, 2018

It's a language change. I think the Core Team could approve this without a review by acclamation, but it should at least be given the opportunity to formally say that.

#endif

#if swift(<4.1.9)
let d = 1
#if swift(<10)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a five-year time bomb. Why not Swift 99?

@rintaro
Copy link
Member

rintaro commented Feb 9, 2018

Implementation itself looks good :)

@hashemi
Copy link
Contributor Author

hashemi commented Dec 20, 2018

Reimplemented in #17960

@hashemi hashemi closed this Dec 20, 2018
@AnthonyLatsis AnthonyLatsis removed the swift evolution pending discussion Flag → feature: A feature that has a Swift evolution proposal currently in review label Nov 8, 2023
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.

6 participants