-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Parse] Improve diagnostic for deprecated protocol<...> syntax #3631
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
This looks great, I think maybe the error message should specify that the syntax ‘is deprecated and not needed here’ rather than implying the construct is useless? |
.fixItRemove({ProtocolLoc, LAngleLoc}) // remove 'protocol<' | ||
.fixItRemove(RAngleLoc); // remove '>' | ||
if (Status.isSuccess()) { | ||
// Only if we have complete prtocol<...> composition, diagnose deprecated. |
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.
Small nitpick: typo in this comment
@joewillsher Thank you for the message suggestion! I'll do that. |
No problem at all, thanks doing this! |
3ff8610
to
fb11d8d
Compare
Updated warning message for single protocol composition: |
@@ -230,7 +230,7 @@ func test_lambda() { | |||
|
|||
func test_lambda2() { | |||
{ () -> protocol<Int> in | |||
// expected-warning @-1 {{'protocol<...>' composition syntax is deprecated; join the protocols using '&'}} | |||
// expected-warning @-1 {{'protocol<...>' composition syntax is deprecated and not needed 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.
Could you please test the fixit is working 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.
Thank you! done.
* Don't emit deprecated warnings for incomplete protocol<...>. E.g: `func fn(x: protocol<P) {}` * Different message for single protocol compostion. E.g: `typealias MyError = protocol<Error>`
fb11d8d
to
a160f0f
Compare
Thanks all! @swift-ci please test and merge. |
@swift-ci Please smoke test |
@swift-ci Please test |
Tests passed, merging. |
Looks great, thank you! |
What's in this pull request?
Don't emit deprecated warnings for incomplete protocol<...>.
Because other error diagnostics are already emitted
Moreover, the current fix-it tries to remove
)
afterP
Different message for single protocol compostion.
Because
"join the protocols using '&'"
is not relevant in this caseCC: @DougGregor, @joewillsher
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
A smoke test on macOS does the following:
device standard libraries are not built.
version of these tests are not run.
A smoke test on Linux does the following:
tests are not run.
Validation Testing
Lint Testing
Note: Only members of the Apple organization can trigger swift-ci.