Skip to content
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

@discardableResult ignored when using @MainActor (Xcode 14.0.1) #61597

Closed
417-72KI opened this issue Oct 17, 2022 · 3 comments
Closed

@discardableResult ignored when using @MainActor (Xcode 14.0.1) #61597

417-72KI opened this issue Oct 17, 2022 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@417-72KI
Copy link

Describe the bug
#60545 still alive in Xcode 14.0.1.

Steps To Reproduce

@MainActor
class Foo {
    @discardableResult
    func bar() -> Int {
        return 10
    }
}

@MainActor
@discardableResult
func baz() -> Bool {
    return true
}

@discardableResult
func qux() -> Double {
    return 0
}

func reproduceIssue() {
    Task {
        await Foo().bar()
        await baz()
        qux()
        return
    }
}

@MainActor
func reproduceIssue2() {
    Foo().bar()
    baz()
    qux()
}

Expected behavior
No warnings on each lines.

Screenshots
image

Environment (please fill out the following information)

  • OS: macOS 12.6
  • Xcode Version: 14.0.1 (14A400)
@417-72KI 417-72KI added the bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. label Oct 17, 2022
@xedin
Copy link
Contributor

xedin commented Oct 17, 2022

I think this is a dupe of #60276. Please use the latest 5.7 or main branch toolchain to verify and close. /cc @theblixguy

@theblixguy
Copy link
Collaborator

The fix was merged a bit late into the 5.7 branch, so it didn't make the cut for Xcode 14 or 14.0.1, but I can verify it's fixed on Xcode 14.1 beta.

@417-72KI
Copy link
Author

I verified it fixed on Xcode 14.1 RC (14B47). Thx, @theblixguy !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

3 participants