You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfkey pathsFeature: key paths (both native and Objective-C)
Person.name is a constant, so I'd assume that \Person.name produces a `KeyPath`. And this is indeed what happens, but when I print the key path's description or dump it, the word "WritableKeyPath" appears in several places.
What's the relationship between WritableKeyPath and KeyPath? Why does String(describing: nameKeyPath) say it's a "WritableKeyPath"?
We don't have any runtime information that distinguishes `let` properties from `var` properties yet, so the key path runtime always produces a WritableKeyPath dynamically.
Yeah, building with a Swift 5 compiler and running with a Swift 5 runtime, a key path that refers to a `let` property ought to be both statically and dynamically read-only.
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfkey pathsFeature: key paths (both native and Objective-C)
Additional Detail from JIRA
md5: daca61aaec27b11a3fc4299bb7b7071f
relates to:
Issue Description:
Maybe I'm not understanding something, but this puzzles me (Swift 4.0, Xcode 9.1).
I'm creating a `KeyPath` in the REPL:
Person.name
is a constant, so I'd assume that\Person.name
produces a `KeyPath`. And this is indeed what happens, but when I print the key path's description or dump it, the word "WritableKeyPath" appears in several places.What's the relationship between
WritableKeyPath
andKeyPath
? Why doesString(describing: nameKeyPath)
say it's a "WritableKeyPath"?Here's my environment:
The text was updated successfully, but these errors were encountered: