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-15916] Not implemented: @MainActor-isolated default arguments for @MainActor-isolated functions #58177

groue opened this issue Feb 26, 2022 · 1 comment


Copy link

groue commented Feb 26, 2022

Previous ID SR-15916
Radar None
Original Reporter @groue
Type Bug

Xcode 13.3 beta 3 (13E5104i)

Additional Detail from JIRA
Votes 2
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 618b69843e92ff0edf9587c87894767b

Issue Description:


The following snippet does not compile:

@MainActor class Foo { }

// error: call to main actor-isolated initializer 'init()' in a synchronous nonisolated context
// @MainActor func f(foo: Foo = Foo()) { }
//                               ^
// note: calls to initializer 'init()' from outside of its actor context are implicitly asynchronous
// @MainActor class Foo {
//                  ^
@MainActor func f(foo: Foo = Foo()) { }

It should compile, since everything in the declaration of the f function is MainActor-isolated.

Copy link

groue commented Feb 27, 2022

@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