Skip to content

Commit ca81a14

Browse files
AnthonyLatsishborla
authored andcommitted
Add fixed crasher to close swiftlang#43442
1 parent e8c92c3 commit ca81a14

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %target-swift-frontend %s -typecheck
2+
3+
// https://github.com/apple/swift/issues/43442
4+
5+
func quickSort<T: Comparable>(_ a: [T]) -> [T] {
6+
if a.isEmpty {
7+
return a
8+
} else {
9+
let head = a[0]
10+
let body = a[1..<a.count]
11+
return quickSort(body.filter({$0 < head})) + [head] + quickSort(body.filter({$0 >= head}))
12+
}
13+
}

0 commit comments

Comments
 (0)