-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Getting "unused" warning from function annotated with "@discardableResult" #60276
Comments
We are also seeing this since beta 4. In our case it's only when the |
Small self-contained reproducer: @discardableResult @MainActor
func a() async -> Int { 5 }
func b() async {
await a()
} I get this on 5.7:
But no such warning on 5.6. Also, if you remove the |
I have opened a PR to fix it. |
I'm still seeing the warnings in Xcode version 14.0 (14A309). @dfeinzimer mentioned the same in #57477. Do you want to reopen this issue or should I create a new one? |
Same here with @dominikmayer. Xcode version 14.0 (14A309) and warnings only surface for |
Same here with @loopbackseal. Xcode version 14.0.1 (14A400). Seems to still be contained to async methods. |
Describe the bug
I've started to see unused warnings crop up in Xcode 14 beta 4 for endpoints that are annotated with
@discardableResult
.Steps To Reproduce
It's not always easy to reproduce, but I've specifically gotten them to appear in the following repo/project/file:
Steps to reproduce the behavior:
d526b07053d46a740936e50be436f78c7ce7b092
TestStoreTask
is annotated with@discardableResult
.Expected behavior
I expect no warning.
Screenshots
![image](https://user-images.githubusercontent.com/658/181583696-e3d59ed0-f3b8-4af7-b474-811a92273370.png)
Environment (please fill out the following information)
Additional context
N/A
The text was updated successfully, but these errors were encountered: