In Context Inheritance, the proposal says:
If called from a context that is not running inside a task:
…
• execute on the global concurrent executor and be non-isolated with regard to any actor.
However, later in the detailed design's Actor Context Propogation, it gives the example:
func notOnActor(_: @Sendable () async -> Void) { }
actor A {
func f() {
notOnActor {
await g() // must call g asynchronously, because it's a @Sendable closure
}
Task {
g() // okay to call g synchronously, even though it's @Sendable
}
}
func g() { }
}
In the new task, it is okay to call g(), which must be because it is in an actor context—but that task is presumably a top-level task that is not running inside a parent task.
So I read an inconsistency. Should top-level tasks be non-isolated with regard to any actor, or not?