Skip to content

Commit 99711e8

Browse files
committed
Tweak key path tests for swift-4.2-branch.
1 parent 607bb4e commit 99711e8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

test/Constraints/keypath.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ struct S {
66
init() {
77
let _: WritableKeyPath<S, Int> = \.i // no error for Swift 3/4
88

9-
S()[keyPath: \.i] = 1
9+
S()[keyPath: \S.i] = 1
1010
// expected-error@-1 {{cannot assign to immutable expression}}
1111
}
1212
}
1313

1414
func test() {
1515
let _: WritableKeyPath<C, Int> = \.i // no error for Swift 3/4
1616

17-
C()[keyPath: \.i] = 1 // warning on write with literal keypath
17+
C()[keyPath: \C.i] = 1 // warning on write with literal keypath
1818
// expected-warning@-1 {{forming a writable keypath to property}}
1919

20-
let _ = C()[keyPath: \.i] // no warning for a read
20+
let _ = C()[keyPath: \C.i] // no warning for a read
2121
}

test/Constraints/keypath_swift_5.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ struct S {
66
init() {
77
let _: WritableKeyPath<S, Int> = \.i // expected-error {{type of expression is ambiguous without more context}}
88

9-
S()[keyPath: \.i] = 1
9+
S()[keyPath: \S.i] = 1
1010
// expected-error@-1 {{cannot assign to immutable expression}}
1111
}
1212
}
1313

1414
func test() {
1515
let _: WritableKeyPath<C, Int> = \.i // expected-error {{type of expression is ambiguous without more context}}
1616

17-
C()[keyPath: \.i] = 1
17+
C()[keyPath: \C.i] = 1
1818
// expected-error@-1 {{cannot assign to immutable expression}}
1919

20-
let _ = C()[keyPath: \.i] // no warning for a read
20+
let _ = C()[keyPath: \C.i] // no warning for a read
2121
}

0 commit comments

Comments
 (0)