Misleading error "Sending 'self' risks causing data races" when it's another object that's causing the issue #82021
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
Description
The below code results in the following error on the "print(foo)" line:
despite the issue being that "object" is being captured in the main actors closure, not the fact self is being referenced in this closure. Indeed, when I move the guard line out of the main actor, the code compiles fine.
Reproduction
Expected behavior
The error should be clear about what the issue is which is that object is being captured in a main-actor isolated closure.
Environment
Apple Swift version 6.1 (swift-6.1-RELEASE)
Target: arm64-apple-macosx15.0
Additional information
No response
The text was updated successfully, but these errors were encountered: