-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SE-0290] Add #unavailable (Negative platform checks) #33932
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
Conversation
fab737a
to
291bfef
Compare
I notice now that that the underlying |
5d6780a
to
04bf875
Compare
cb4ed40
to
b28f256
Compare
I updated the implementation to match the final revision (imply the wildcard). The implementation now rejects explicit I was unsure how to proceed with |
@tkremenek Any updates on the plan for this feature? I'd like to keep the branch updated, but only when this actually moves forward. |
Sorry this got missed. Could you please fix the merge conflicts? I've left some comments and have asked other folks to chime in as well. In the future, please feel free to ping someone who has modified the surrounding code for review, or ask on the Swift forums for review. |
cc @rintaro for parser changes, cc @amartini51 as there may be potential TSPL changes. |
Thanks @varungandhi-apple! I'll rebase it and apply the changes. |
@varungandhi-apple I've updated it. Had to lose the commit history though because it was 3000 commits behind main 😢 |
lib/Sema/TypeCheckAvailability.cpp
Outdated
auto makeResult = ^(Optional<AvailabilityContext> TrueRefinement, | ||
Optional<AvailabilityContext> FalseRefinement) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Please use C++ lambda syntax instead of using block syntax. (I'm not sure if MSVC supports the latter, also we use lambda syntax with [ ... ]
elsewhere in the code.)
lib/Sema/TypeCheckAvailability.cpp
Outdated
auto Queries = available->getQueries(); | ||
|
||
for (auto *Spec : Queries) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look like Queries
is getting used later.
auto Queries = available->getQueries(); | |
for (auto *Spec : Queries) { | |
for (auto *Spec : available->getQueries()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your patience with the review. Mostly LGTM, left a couple of minor comments. You may want to squash some of the later commits.
@swift-ci smoke test |
@varungandhi-apple There was a typo in the result builder logic, I cleaned it up further and squashed the rest. |
@swift-ci smoke test |
Hm it failed because of SwiftSyntax not knowing the keyword, do I need to push something in its repo first for it to pass here? |
You need to re-generate the files in the SwiftSyntax repo. For this:
|
@ahoppen Thanks! I tried that but I get errors about python imports. Do I need a specific python version?
|
I haven’t seen that error message before. I’m using Python 2. Could you share the entire error message? Maybe I’ll be able to figure out what’s going on from there. |
With Python 2, I get a slightly different error:
|
That’s probably because |
Should've tried that first. It worked, thanks! |
Nice! Let’s see what CI has to say now. swiftlang/swift-syntax#296 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes to gyb_syntax_support
are looking good to me. I didn’t look at the other changes.
@swift-ci test and merge |
I think we need to merge swiftlang/swift-syntax#296 first for this to become green, right? |
You need to merge them at the same time. Make sure that both have a green CI status before merging either. |
Ah I see, it failed because we needed to reference the PR in the command. |
Yeah, so they've always been tested in unison in PR testing so far (because you referenced the other PR) and thus you also need to merge them together. |
My bad, sorry about that. I should've paid more attention. @swift-ci please test |
@rockbruno could you submit a PR adding a "Swift Next" entry to the ChangeLog and mentioning this new feature there? Here's an example PR which does that. |
Done: #38390 |
Implementation for SE-0290: https://github.com/apple/swift-evolution/blob/main/proposals/0290-negative-availability.md
Swift evolution thread: https://forums.swift.org/t/support-negative-availability-literals/