mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 14:20:35 +01:00
[Bug] sorting #132
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jw-y on GitHub (Apr 4, 2024).
expected output:
got:
@holzensp commented on GitHub (Apr 4, 2024):
This is wild! I managed to reproduce. Thanks for the bug report.
@odenix commented on GitHub (Apr 4, 2024):
I don't think this is a bug.
The documentation of
List.sortWithsays:So it should be
local com = (a, b) -> a > binstead oflocal com = (a, b) -> a >= b.I checked Swift's and Scala's
sortWithfunctions, and they have the same requirement. Swift additionally states that the comparator function must be irreflexive.@jw-y commented on GitHub (Apr 4, 2024):
Either case, I don't think this is any way intended.
FYI,
found the location of the bug.
58ed8242af/pkl-core/src/main/java/org/pkl/core/stdlib/base/MergeSort.java (L61)first
midshould bemid-1@odenix commented on GitHub (Apr 4, 2024):
That indeed looks like a bug. I guess a reflexive comparator function should only give you an unstable/inefficient sort, not a wrong sort.