-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SR-1752] Fix warning about unused result if return type is Void? #3057
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 |
Thanks for working on this, but as the test runs above show, this causes a regression on the test suite. |
I know, we just launched the CI in the lab to have a look at the test results and I didn't have time to update the tests yet. An update will follow in the next few days. |
OK, I updated the tests and they should pass now.
This should simplify the rules on when a warning about an unused result is issued. Now such a warning should only be issued if the result type is not |
I resolved the merge conflicts that occurred because another test case was added to |
@ahoppen Looks like another conflict got introduced. Could you rebase again? |
Once again the merge conflicts just resulted from another test being added to |
Thank you! @swift-ci please test |
macOS failures are unrelated to this patch. Nice work @ahoppen 💥 |
Once more, with feeling! @swift-ci please test and merge |
Mailing list links are down. |
What's in this pull request?
Right now, if a function has a return value of
Optional<Void>
a warning about an unused result is generated. This also applies for the use of optional chaining inside a ternary operator, e.g. ifc.f()
returnsVoid
and you dotrue ? c?.f() : c?.f()
a warning sayingExpression of type '()?' is unused
is generated.Resolved bug number: (SR-1752)
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.