Skip to content

Commit 14a2255

Browse files
committed
Add tests for keypaths converted to funcs with inout param
1 parent 061a09e commit 14a2255

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/expr/unary/keypath/keypath.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,3 +1258,17 @@ func f(_ arr: [Int?]) {
12581258
let _: [Int] = arr.compactMap(\.?)
12591259
let _: [Int] = arr.map(\.!)
12601260
}
1261+
1262+
func testKeyPathInout() {
1263+
let _: (inout String) -> Int = \.count
1264+
let _: (inout String) -> Int = \String.count
1265+
let _: (inout String) -> Int? = \.count
1266+
1267+
func takesInout(_: (inout String) -> Int) {}
1268+
func takesInoutOpt(_: (inout String) -> Int?) {}
1269+
1270+
takesInout(\.count)
1271+
takesInout(\String.count)
1272+
takesInoutOpt(\.count)
1273+
takesInoutOpt(\String.count)
1274+
}

0 commit comments

Comments
 (0)