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

This diagnostic tells me an explicitly async call is implicit #74472

Open
mattmassicotte opened this issue Jun 17, 2024 · 0 comments
Open

This diagnostic tells me an explicitly async call is implicit #74472

mattmassicotte opened this issue Jun 17, 2024 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels

Comments

@mattmassicotte
Copy link

Description

Perhaps I'm misunderstanding, but it sure looks to me like this call is explicitly asychronous.

 1 | class Foo {
   |       `- note: class 'Foo' does not conform to the 'Sendable' protocol
 2 |     init() async {
 3 | 
   :
10 | 
11 |     init() async {
12 |         let value = await Foo()
   |                           `- error: non-sendable type 'Foo' returned by implicitly asynchronous call to nonisolated function cannot cross actor boundary
13 | 
14 |         self.foo = value

Reproduction

class Foo {
    init() async {
    }
}

@MainActor
class Bar {
    let foo: Foo

    init() async {
        let value = await Foo()

        self.foo = value
    }
}

Expected behavior

I would not expect the diagnostic to tell me a call explicitly marked with async is implicit.

Environment

Apple Swift version 6.0-dev (LLVM bf8bbb910874156, Swift a0bb875)
Target: arm64-apple-macosx14.0

Additional information

No response

@mattmassicotte mattmassicotte added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Jun 17, 2024
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. triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

1 participant