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.
2 parents 8ecb8fd + 6451ff8 commit 9411807Copy full SHA for 9411807
test/IDE/complete_tuple_label_in_keypath.swift
@@ -0,0 +1,22 @@
1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COMPLETE | %FileCheck %s
2
+
3
+func foo() -> [(Int, [Int])] {
4
+ var searchResults: [Int: [Int]] = [:]
5
+ searchResults
6
+ .map { $0 }
7
+ .sorted(by: \.#^COMPLETE^#key)
8
+}
9
10
+public extension Sequence {
11
+ func sorted<T: Comparable>(by keyPath: KeyPath<Element, T>) -> [Element] {
12
+ return sorted { a, b in
13
+ return a[keyPath: keyPath] > b[keyPath: keyPath]
14
+ }
15
16
17
18
+// CHECK: Begin completions,
19
+// CHECK-DAG: Pattern/CurrNominal: key[#Int#];
20
+// CHECK-DAG: Pattern/CurrNominal: value[#[Int]#];
21
+// CHECK: End completions
22
0 commit comments