-
Notifications
You must be signed in to change notification settings - Fork 10.5k
SR-2709: @available(swift, ...) #4985
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-2709: @available(swift, ...) #4985
Conversation
/// The entity might be unavailable, because it was introduced after | ||
/// the minimum version. | ||
/// The entity might be unavailable at runtime, because it was introduced | ||
/// after the requested minimum platform version. |
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: You say "platform or language" version above but "platform" here.
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.
That's correct; potential-availability only applies to platform, not language.
@@ -618,21 +619,24 @@ class AvailableAttr : public DeclAttribute { | |||
/// Indicates when the symbol was obsoleted. | |||
const Optional<clang::VersionTuple> Obsoleted; | |||
|
|||
/// Indicates if the declaration has unconditional availability. | |||
const UnconditionalAvailabilityKind Unconditional; | |||
/// Indicates if the declaration has plafrorm-agnostic availability. |
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: plafrorm
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, fixed.
dd3489d
to
87bce60
Compare
@swift-ci Please smoke test |
"'swift' version-availability must be specified alone", ()) | ||
|
||
ERROR(pound_available_swift_not_allowed, none, | ||
"Swift language version checks not allowed in #available(...)", ()) |
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.
Please add tests for these diagnostics!
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.
fixed
@@ -3104,6 +3104,10 @@ ERROR(availability_decl_unavailable_in_swift_msg, none, | |||
NOTE(availability_marked_unavailable, none, | |||
"%0 has been explicitly marked unavailable here", (DeclName)) | |||
|
|||
NOTE(availability_introduced_in_swift, none, | |||
"%0 was introduced in swift %1", |
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.
Nitpick: "Swift" should be capitalized here.
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.
fixed
// FIXME: Use of the platformString here is non-awesome for application | ||
// extensions. | ||
diagnose(D, diag::availability_obsoleted, Name, | ||
Attr->prettyPlatformString(), | ||
(Attr->isLanguageVersionSpecific() ? | ||
"swift" : Attr->prettyPlatformString()), |
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.
…and here.
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.
fixed
87bce60
to
220fc24
Compare
@swift-ci please test and merge |
@swift-ci please smoke test and merge |
@swift-ci please test and merge |
@swift-ci please smoke test |
@swift-ci please test and merge |
@swift-ci please clean test and merge |
UnconditionalAvailabilityKind => PlatformAgnosticAvailabilityKind ::UnavailableInCurrentSwift => ::SwiftVersionSpecific Plus a couple related method renamings. Prep work for SR-2709.
dc7a5ca
to
3ca7555
Compare
@swift-ci Please smoke test and merge |
Looks like this is implemented — I can mark it as such in swift-evolution. Would that be under Swift 4 or Swift 3.1? |
This PR addresses SR-2709, and corresponds to the proposal currently under review in
https://lists.swift.org/pipermail/swift-evolution-announce/2016-September/000286.html
It's a relatively minor extension to the
@available(...)
system to permit availability testingby swift language version. A companion to the previous PR #4826 that enables command-line
backwards compatibility adjustment of the compiler's effective language version.
I'm posting here for implementation review; it should not be merged until the evolution proposal
has been reviewed and approved by the community. I'll amend here to track any changes that
come up during that discussion.
Resolves SR-2709.