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

[Parse] Warn if the same argument is specified more than once in @available #20997

Merged
merged 2 commits into from Dec 4, 2018

Conversation

Projects
None yet
2 participants
@brentdax
Collaborator

brentdax commented Dec 4, 2018

Previously, if an argument to an @available attribute was duplicated, the first value would be silently dropped. With this change, the compiler produces a warning instead. (We emit a warning instead of an error to preserve source compatibility.)

Resolves rdar://problem/46348825.

brentdax added some commits Dec 4, 2018

[Parse] Diagnose duplicate @available arguments
Previously, if the `message` or `available` argument to an `@available` attribute was specified two or more times, the last value would be used and the earlier ones would be silently discarded. This change emits a warning instead; we can strengthen this into an error in a future version of Swift.

Fixes rdar://problem/46348825.
[Parse] Detect more duplicate @available arguments
Add the warning for introduced, deprecated, and obsoleted; also ensures behavior is *completely* backwards-compatible by continuing to use the last argument’s value, rather than the first one.

@brentdax brentdax requested a review from jrose-apple Dec 4, 2018

@brentdax

This comment has been minimized.

Collaborator

brentdax commented Dec 4, 2018

@swift-ci please smoke test

@brentdax brentdax changed the title from A diagnosis from the argument clinic to [Parse] Warn if the same argument is specified more than once in @available Dec 4, 2018

@brentdax brentdax merged commit facaad1 into apple:master Dec 4, 2018

2 checks passed

Swift Test Linux Platform (smoke test)
Details
Swift Test OS X Platform (smoke test)
Details

@brentdax brentdax deleted the brentdax:a-diagnosis-from-the-argument-clinic branch Dec 4, 2018

jshier added a commit to jshier/swift that referenced this pull request Dec 9, 2018

A diagnosis from the argument clinic (apple#20997)
[Parse] Warn if the same argument is specified more than once in @available
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment