Skip to content

Commit fab4b87

Browse files
[tests] Adjusting key path tests to diagnostic of key path refering to init methods
1 parent faba29a commit fab4b87

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

test/Constraints/keypath.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,8 @@ let some = Some(keyPath: \Demo.here)
4040
func testFunc() {
4141
let _: (S) -> Int = \.i
4242
_ = ([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}}
43+
_ = \S.init // expected-error {{key path cannot refer to initializer 'init()'}}
44+
_ = ([S]()).map(\.init) // expected-error {{key path cannot refer to initializer 'init()'}}
4845

4946
let kp = \S.i
5047
let _: KeyPath<S, Int> = kp // works, because type defaults to KeyPath nominal

0 commit comments

Comments
 (0)