Skip to content

AST: support availability on Windows #34439

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 1 commit into from
Nov 10, 2020
Merged

Conversation

compnerd
Copy link
Member

Enable Windows specific availability annotations in Swift.

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

CC: @benrimmington

@compnerd
Copy link
Member Author

@swift-ci please test Windows platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 2214d7f54e365daabf3c48ff95eed9b8c02b2a2d

@compnerd
Copy link
Member Author

@swift-ci please test

1 similar comment
@compnerd
Copy link
Member Author

@swift-ci please test

@benrimmington
Copy link
Contributor

What happens when a version number is used?

The parser/runtime might allow:

  • #available(Windows 10, *) is always false on Windows.
  • @available(Windows 10, *)
  • @available(Windows, introduced: 10, deprecated: 11, obsoleted: 12)

@compnerd
Copy link
Member Author

compnerd commented Oct 27, 2020

I can add the additional test cases, however, I'm not sure that the versions make too much sense. Microsoft has announced that Windows 10 is the last version. Do we really want to have build version numbers here? I think that can get confusing and unwieldy. You would be looking at something like:

@available(Windows, introduced: 10.0.107763.1, deprecated: 10.0.19140.2)

@benrimmington
Copy link
Contributor

I was just wondering what happens when someone tries using version numbers on Windows. Does the compiler crash? Or is there an error or warning? Or are version numbers allowed at compile-time, but ignored at run-time?

https://github.com/apple/swift/blob/c10064a698d2b6424353a83b216514855d668f41/stdlib/public/core/Availability.swift#L39-L42

@compnerd
Copy link
Member Author

Ah, okay. I'll certainly add those test cases. It shouldn't crash the compiler, merely fail (warning/error). The version numbers aren't supported.

@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

This seems to cause some problems for SK-LSP. I want to get the reviews taken care of for the change, but leave the merging to until after the SourceKit-LSP issues have been worked out.

@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

@swift-ci please test Windows platform

Enable Windows specific availability annotations in Swift.
@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

@swift-ci please test Windows platform

@compnerd
Copy link
Member Author

The additional tests have been added, I think that all the review comments have been addressed and SK-LSP has been updated, so optimistically merging this for now.

@compnerd compnerd merged commit b402827 into swiftlang:main Nov 10, 2020
@compnerd compnerd deleted the unavailable branch November 10, 2020 19:28
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.

3 participants