Task
created from a method with an isolated parameter breaks actor isolation
#62568
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
concurrency
Feature: umbrella label for concurrency language features
triage needed
This issue needs more specific labels
Description
A
Task
created from a method that executes within the isolated context of a passed-in actor should inherit the execution context of the passed-in actor, but does not.Steps to reproduce
The following code fails to compile:
Here's a screenshot of the same code with the inlined compiler error for folk who like Xcode's syntax hilighting:
Expected behavior
I would expect the above code to compile without modification.
Per the Task documentation, a not-detached
Task
"inherits the priority and actor context of the caller", meaning that aTask
created in anisolated ActorType
method should execute within the isolated context of the passed-in actor.Environment
I was able to reproduce this issue on the following swift compiler versions (I did not try other versions):
I was able to reproduce this issue on the following Xcode versions (I did not try other versions):
Additional context
This bug report was first posted as a question in the Swift forums.
Unlike #62503 and #62505, I have not found a way to force the compiler to execute the
Task
above in the expected execution context.The text was updated successfully, but these errors were encountered: