-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[Parser] Improve diagnostics for special platforms in available attribute. #18895
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
|
@swift-ci please test |
jrose-apple
left a comment
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 for picking this up!
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: I suggest using this as "platform 'swift'" (like "platform '*'"). It seems a little clearer to me.
After seeing it in context, I also think it might just be better to simplify to something like "expected 'introduced', 'deprecated', or 'obsoleted' in '%0' attribute for platform 'swift'". It does mean we have to keep it up to date, but it's less circumlocution.
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
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 could also apply to obsoleted or introduced, right?
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.
In general, obsoleted and introduced must always have a version number alongside, while version for deprecated is optional. In this particular case (i.e., platform 'swift'), however, deprecated cannot be used alone and must followed by a version. So, the motivation of such warning here is for deprecated only.
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: To match the tone of other diagnostics, I would prefer something more like "cannot be used with" instead of "is infeasible for". (I'm also not sure we call them "arguments" in attributes, but in this case I think just leading with '%0' is fine.)
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.
Done
lib/Parse/ParseDecl.cpp
Outdated
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.
Is it possible to add a fix-it for this one?
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.
Good idea! Fix-it added.
|
Thanks for the review, Jordan! I updated the code to address your comments. |
jrose-apple
left a comment
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, this looks great!
|
@swift-ci Please test |
|
Build failed |
|
Build failed |
rintaro
left a comment
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.
Looks great! thank you!
|
Oh, just noticed some warnings are raised from |
|
I updated the code to fix the warnings in In addition, I checked other projects and found corelibs-libdispatch affected. I created #391 there. |
|
Whoops. Thank you for checking. cc @airspeedswift |
airspeedswift
left a comment
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.
LGTM. Thanks!
|
@swift-ci please test |
|
Let's wait for the SCD changes before merging. |
…bute. This patch adds warnings when a version number is used on the non-specific '*' platform. In addition, it fixes some misleading warning messages on 'swift' platform. Resolves: SR-8598.
|
Hi Jordan, thank you for taking care of the dependency PR #391 in swift-corelibs-libdispatch repo. I just updated the code here to make sure it is conflict-free. |
|
Let's do it! @swift-ci Please test |
swiftlang/swift#18895. Signed-off-by: Kim Topley <ktopley@apple.com>
This patch adds warnings when a version number is used on the non-specific
*platform. For example, it warns unexpected version number in 'available' attribute for non-specific platform '*' in the following case:In addition, it fixes some misleading warning messages on
swiftplatform as mentioned by @airspeedswift , including the following cases:Resolves SR-8598.