-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SR-1052][Parser] Warning + FixIt for @warn_unused_result #2760
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
9155608
to
a49dcad
Compare
a49dcad
to
600c6e9
Compare
I rebased and fixed the conflicts. |
CC @DougGregor @jopamer @jrose-apple @tanadeau If you could submit test changes |
@gribozavr I'm in the process of rebasing and retesting now. Do you want me to split that commit off into another PR because it's big enough to be its own PR or because it's the commit tending to cause conflicts? If it's the latter, it won't help as the problematic file is for the newly introduced fixit to remove |
600c6e9
to
be5e811
Compare
Rebased. |
@tanadeau Because we can land those changes and stop worrying about them, while making the patch smaller to review. |
"expected a string following ':' for '%0' parameter", (StringRef)) | ||
WARNING(attr_warn_unused_result_unknown_parameter,none, | ||
"unknown parameter '%0' in 'warn_unused_result' attribute", (StringRef)) | ||
ERROR(attr_warn_unused_result_removed,none, |
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.
This should be a warning rather than an error for now, so that people can update their code at their leisure.
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.
I made it an error as that was what @lattner put in the JIRA ticket. I can change that if still desired though.
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.
I think any diagnostic that says "x has no effect and the right fix is to remove it" should be a warning rather than an error.
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 makes sense to me. I based it off the ticket, and an error seemed to follow the pattern for "renamed" attributes since there were not already any that were completely removed. I'll make that change.
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.
Diagnostic changed to warning.
Other than those two comments the compiler changes look good to me. |
@gribozavr I split out the commit you requested into a new PR (#2923). |
be5e811
to
3324b81
Compare
I rebased against latest master (including merge of #2923). This PR is now much smaller. |
3324b81
to
f0c65dc
Compare
I believe I've addressed all of the comments. I changed the name of the PR since the diagnostic is now a warning instead of an error. |
Thanks, Trent! Let's do one last CI build. @swift-ci Please test |
The Linux test failure appears to be unrelated to this PR. |
Yep, I'm willing to call this good enough. Merging! |
Thanks! |
@tanadeau I'm afraid there's an issue: import Foundation
class X {
@warn_unused_result
@objc
func foo() -> Int {}
}
Why does it produce an error? |
@gribozavr, I think I have a fix for that issue. The return value in my |
@gribozavr I created #2970 with the fix and a new test. |
What's in this pull request?
Part 6 (final part) of SR-1052: Support for the now-useless
@warn_unused_result
is removed with an error and fixit.Resolved bug number: (SR-1052)
Before merging this pull request to apple/swift repository:
Triggering Swift CI
The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:
Smoke Testing
Validation Testing
Lint Testing
Note: Only members of the Apple organization can trigger swift-ci.