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 061a09e commit 14a2255Copy full SHA for 14a2255
test/expr/unary/keypath/keypath.swift
@@ -1258,3 +1258,17 @@ func f(_ arr: [Int?]) {
1258
let _: [Int] = arr.compactMap(\.?)
1259
let _: [Int] = arr.map(\.!)
1260
}
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