I’d like to be lazy and leave out the classname on a key path whenever possible. I thought that if PartialKeyPath was specified as the argument type, that meant the compiler should be able to figure out what the class is, but this does not seem to be the case.
func test() {
let path = ThePath()
walkThePath(aPath:path, forKey:\.isWinding) // Expression type '()' is ambiguous without more context
walk(aPath:path, forKey:\.isWinding) // Type of expression is ambiguous without more context
}
I'm not sure whether it was supposed to be supported or not, but either way it's a reasonable feature request. Please file at bugs.swift.org.
Jordan
···
On Jan 11, 2018, at 14:41, Kenny Leung via swift-users <swift-users@swift.org> wrote:
Hi All.
I’d like to be lazy and leave out the classname on a key path whenever possible. I thought that if PartialKeyPath was specified as the argument type, that meant the compiler should be able to figure out what the class is, but this does not seem to be the case.
func test() {
let path = ThePath()
walkThePath(aPath:path, forKey:\.isWinding) // Expression type '()' is ambiguous without more context
walk(aPath:path, forKey:\.isWinding) // Type of expression is ambiguous without more context
}
On Jan 11, 2018, at 3:12 PM, Jordan Rose <jordan_rose@apple.com> wrote:
I'm not sure whether it was supposed to be supported or not, but either way it's a reasonable feature request. Please file at bugs.swift.org <Issues · apple/swift · GitHub.
Jordan
On Jan 11, 2018, at 14:41, Kenny Leung via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
Hi All.
I’d like to be lazy and leave out the classname on a key path whenever possible. I thought that if PartialKeyPath was specified as the argument type, that meant the compiler should be able to figure out what the class is, but this does not seem to be the case.
func test() {
let path = ThePath()
walkThePath(aPath:path, forKey:\.isWinding) // Expression type '()' is ambiguous without more context
walk(aPath:path, forKey:\.isWinding) // Type of expression is ambiguous without more context
}
On Jan 11, 2018, at 3:12 PM, Jordan Rose <jordan_rose@apple.com <mailto:jordan_rose@apple.com>> wrote:
I'm not sure whether it was supposed to be supported or not, but either way it's a reasonable feature request. Please file at bugs.swift.org <Issues · apple/swift · GitHub.
Jordan
On Jan 11, 2018, at 14:41, Kenny Leung via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
Hi All.
I’d like to be lazy and leave out the classname on a key path whenever possible. I thought that if PartialKeyPath was specified as the argument type, that meant the compiler should be able to figure out what the class is, but this does not seem to be the case.
func test() {
let path = ThePath()
walkThePath(aPath:path, forKey:\.isWinding) // Expression type '()' is ambiguous without more context
walk(aPath:path, forKey:\.isWinding) // Type of expression is ambiguous without more context
}