I am curious, why sorted(by:) tries to compare the element with itself? I've noticed that when sorting a list of files, but it is quite easy to make a reproducer:
https://github.com/TheIndifferent/swift-sort-duplicates/blob/master/Sources/swift-sort-duplicates/main.swift
nnnnnnnn
(Nate Cook)
2
Can you try this in Swift 5? The sort algorithm in Swift 4.2 used partitioning, which apparently may have compared elements against themselves.
1 Like
It does work with Swift 5. Thanx for the explanation!
1 Like