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-8598] Deprecating then obsoleting can be error prone #51114

Closed
airspeedswift opened this issue Aug 21, 2018 · 0 comments
Closed

[SR-8598] Deprecating then obsoleting can be error prone #51114

airspeedswift opened this issue Aug 21, 2018 · 0 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself good first issue Good for newcomers parser Area → compiler: The legacy C++ parser

Comments

@airspeedswift
Copy link
Member

Previous ID SR-8598
Radar None
Original Reporter @airspeedswift
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, Parser, StarterBug
Assignee @airspeedswift
Priority Medium

md5: 5c4c6c70a919e1655b746eba620fc1c7

Issue Description:

If you deprecate something with the unconstrained:

@available(*, deprecated)

then later change your mind and decide to tie it to a Swift version, it's easy to accidentally write this:

@available(*, deprecated: 4.2)

which will keep the deprecation firing regardless of Swift version. You probably meant this:

@available(swift, deprecated: 4.2)

Worse, if you introduce a second availability:

@available(*, deprecated, obsoleted: 4.2)

this doesn't obsolete and it no longer warns.

Supplying versions alongside * should probably trigger a warning, similar to this one:

@available(swift, deprecated)
Warning: Unknown platform 'swift' for attribute 'available'

This warning could probably also be reworded to be clearer, since swift is a totally known platform, it just needs a version.

@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
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself good first issue Good for newcomers parser Area → compiler: The legacy C++ parser
Projects
None yet
Development

No branches or pull requests

1 participant