-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
@isolated(any)Feature → attributes: The @isolated(any) attributeFeature → attributes: The @isolated(any) attributeSILGenArea → compiler: The SIL generation stageArea → compiler: The SIL generation stageactor isolationFeature → concurrency: Actor isolationFeature → concurrency: Actor isolationbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfconcurrencyFeature: umbrella label for concurrency language featuresFeature: umbrella label for concurrency language featuresswift 6.2unexpected behaviorBug: Unexpected behavior or incorrect outputBug: Unexpected behavior or incorrect output
Description
Description
We should be partially applying a nonisolated(nonsending)
function to the actor it should run on, if any, before converting to @isolated(any)
. Instead, we are unconditionally applying it a nil actor.
Reproduction
func test(_ fn: @isolated(any) () async -> Void) {
print(fn.isolation) // nil
}
nonisolated(nonsending) func foo() async {
test {}
}
@main struct Foo {
@MainActor
static func main() async throws {
await foo()
}
}
Expected behavior
MainActor
in this case.
Environment
Additional information
No response
Metadata
Metadata
Assignees
Labels
@isolated(any)Feature → attributes: The @isolated(any) attributeFeature → attributes: The @isolated(any) attributeSILGenArea → compiler: The SIL generation stageArea → compiler: The SIL generation stageactor isolationFeature → concurrency: Actor isolationFeature → concurrency: Actor isolationbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfconcurrencyFeature: umbrella label for concurrency language featuresFeature: umbrella label for concurrency language featuresswift 6.2unexpected behaviorBug: Unexpected behavior or incorrect outputBug: Unexpected behavior or incorrect output