Open
Description
Description
While using a ReferenceWritableKeyPath should be limited to the actor where the property it's referencing is bound, creating such key path should be allowed on any context.
Reproduction
nonisolated func testKeyPath() {
let keyPath: ReferenceWritableKeyPath<UIView, _> = \.backgroundColor // Error: Cannot form key path to main actor-isolated property 'backgroundColor'
}
Expected behavior
ReferenceWritableKeyPath
can be created from any context, but the compiler prevents applying such keypath outside of the context where the property is bound (ie: outside of @MainActor
in the example above).
Environment
swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)
Additional information
cc @hborla