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

Invalid async call in default initialized parameter #73892

Open
mattmassicotte opened this issue May 24, 2024 · 0 comments
Open

Invalid async call in default initialized parameter #73892

mattmassicotte opened this issue May 24, 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

mattmassicotte commented May 24, 2024

Description

This code successfully compiles with the 2024-05-14 6.0 development snapshot in both Swift 5 and Swift 6 mode.

I'm fairly sure that Swift 5.10's error is correct and this code should be invalid.

Reproduction

@MainActor
func doThing(_ value: Int) {
}

class SomeThing {
	let task = Task {
		doThing(42)
	}
}

Expected behavior

With swift 5.10:

swift -enable-experimental-feature StrictConcurrency test.swift
test.swift:7:3: error: expression is 'async' but is not marked with 'await'
                doThing(42)
                ^~~~~~~~~~~
                await 
test.swift:7:3: note: calls to global function 'doThing' from outside of its actor context are implicitly asynchronous
                doThing(42)
                ^

Environment

swift-6.0-DEVELOPMENT-SNAPSHOT-2024-05-14-a

Apple Swift version 6.0-dev (LLVM 5b202efbc95a8bf, Swift a17d360)
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 May 24, 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