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

[SR-15600] Error message for @main types without static func main() should mention possibility of async #57903

marcomasser opened this issue Dec 15, 2021 · 0 comments


Copy link

@marcomasser marcomasser commented Dec 15, 2021

Previous ID SR-15600
Radar None
Original Reporter @marcomasser
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement
Assignee None
Priority Medium

md5: 82dd3146ac564860ac5ac0f42caf506e

Issue Description:

When annotating a type with @main without providing an appropriate method to run, the compiler emits the following error:

'Type' is annotated with @main and must provide a main static function of type () -> Void or () throws -> Void.

But actually, it’s now also valid to add async there. This would help discoverability of this feature. Although I’m not sure adding all four possible combinations of nothing/throws/async is the best thing to do here.

To reproduce, compile this code:

@main struct Main {}

I’m using Xcode 13.2 with Swift 5.5.2.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

1 participant