-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.concurrencyFeature: umbrella label for concurrency language featuresFeature: umbrella label for concurrency language featureskey pathsFeature: key paths (both native and Objective-C)Feature: key paths (both native and Objective-C)standard libraryArea: Standard library umbrellaArea: Standard library umbrella
Description
Description
The new sendable key path diagnostics seems to lose writability when appending a sendable, writable key path.
Reproduction
struct S {
var p = 0
}
struct T {
var s = S()
}
func f() {
let kp1: WritableKeyPath<T, S> & Sendable = \T.s
let kp2: WritableKeyPath<T, Int> & Sendable = kp1.appending(path: \.p)
}
Expected behavior
kp2
should compile, but we get:
Error: Cannot convert value of type 'KeyPath<T, Int>' to specified type 'WritableKeyPath<T, Int>'
Environment
swift-driver version: 1.112.3 Apple Swift version 6.0 (swiftlang-6.0.0.6.8 clang-1600.0.23.1)
Target: arm64-apple-macosx14.0
Additional information
No response
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.concurrencyFeature: umbrella label for concurrency language featuresFeature: umbrella label for concurrency language featureskey pathsFeature: key paths (both native and Objective-C)Feature: key paths (both native and Objective-C)standard libraryArea: Standard library umbrellaArea: Standard library umbrella