a distributed actor's convenience init should be treated as nonisolated

This commit is contained in:
Kavon Farvardin
2021-10-12 11:40:05 -07:00
parent 573ae9bcac
commit a1daee59e4
2 changed files with 12 additions and 2 deletions

View File

@@ -172,3 +172,13 @@ func test_params(
_ = try await distributed.distInt(int: 42) // ok
_ = try await distributed.dist(notCodable: .init())
}
// Actor initializer isolation (through typechecking only!)
distributed actor DijonMustard {
convenience init(conv: ActorTransport) {
self.init(transport: conv)
self.f() // expected-error {{actor-isolated instance method 'f()' can not be referenced from a non-isolated context}}
}
func f() {} // expected-note {{distributed actor-isolated instance method 'f()' declared here}}
}