Skip to content

Commit 9411807

Browse files
authored
Merge pull request swiftlang#61432 from ahoppen/ahoppen/new-test-case
[CodeComplete] Add test case for swiftlang#57237
2 parents 8ecb8fd + 6451ff8 commit 9411807

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)