-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Diagnostics] Warn when the result of a Void-returning function is ignored (by assigning into '_') #29576
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 smoke test |
Ok I need to update a test in SourceKit-LSP too... |
@swift-ci please smoke test |
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 wonder if this warning is really worse it since in warnings-as-errors
setup everybody would get a bunch of new errors about this, which is seems so minor it doesn't really matter?...
@xedin I don’t think the compiler test suite is close enough to real-world code to determine the impact of this change since it uses |
I'm not sure if there is way to run source compatibility in such mode. What I really question is whether such warning is useful or it's just noise and potential project failure source when compiled with |
I think it’s a pretty minor warning since it only affects situations where the function returns |
Alright, fair enough. |
…nored (by assigning into '_')
@swift-ci please smoke test |
@swift-ci please smoke test macOS |
Emit a warning if the user ignores the result of a Void-returning function by assigning into a discard expression, because it is redundant.
Resolves SR-1553