-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Description
Description
Actor-instance isolation shows up as "actor-isolated" in diagnostics. This leads to very confusing errors when you have mismatching isolation with two different actor instances, because the two isolations have the exact same description in the error message. Using the types won't help because it's common for those to be the same too. We should try to use the name of the actor variables, which are often different.
Example of confusion: https://www.reddit.com/r/iOSProgramming/comments/1noix4e/did_apple_out_source_they_error_message_xcode_wtf/
Reproduction
actor MyActor {
static let shared = MyActor()
var name: String = ""
// 'MyActor.shared' might not be the same value as 'self'
func ohNo(_: String = MyActor.shared.name) {}
}
Expected behavior
The above code should produce an error that makes it clear that self
and MyActor.shared
could be different values, so state isolated to MyActor.shared
can't be used because default arguments can only be isolated to self
.
Environment
All Swift versions when IsolatedDefaultValues
is enabled.