We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent faba29a commit fab4b87Copy full SHA for fab4b87
test/Constraints/keypath.swift
@@ -40,11 +40,8 @@ let some = Some(keyPath: \Demo.here)
40
func testFunc() {
41
let _: (S) -> Int = \.i
42
_ = ([S]()).map(\.i)
43
-
44
- // FIXME: A terrible error, but the same as the pre-existing key path
45
- // error in the similar situation: 'let _ = \S.init'.
46
- _ = ([S]()).map(\.init)
47
- // expected-error@-1 {{type of expression is ambiguous without more context}}
+ _ = \S.init // expected-error {{key path cannot refer to initializer 'init()'}}
+ _ = ([S]()).map(\.init) // expected-error {{key path cannot refer to initializer 'init()'}}
48
49
let kp = \S.i
50
let _: KeyPath<S, Int> = kp // works, because type defaults to KeyPath nominal
0 commit comments