Open NachoSoto opened 1 month ago
cc @hborla
I agree, I don't see any reason why this code should produce the invalid send error. Nothing in the auto-closure touches main-actor-isolated state.
Taking a look at this. @NachoSoto thank you for the nice test case!
Description
I'm unable to think of how this could lead to a data race, so I believe it's an invalid diagnostic.
Reproduction
Expected behavior
I would expect this to compile with no problems (like it does on Swift 5).
Actual behavior
Environment
Additional information
Adding
isolation _: isolated (any Actor)? = #isolation
toLog.f
fixes the problem, but: a) That's not backwards compatible with Swift 5.x, making it very cumbersome to write code that's compatible with both b) I fail to see why that's necessary in this case.