sortByRank
misplaces undefined values for reversed comparison functions
#2594
Labels
bug
Something isn't working
(reflects Agoric/agoric-sdk#4260 )
sortByRank
currently usesArray.prototype.sort
directly, and so only works correctly when given acompare
function that considersundefined
strictly bigger (>
) than everything else. This is becauseArray.prototype.sort
bizarrely moves allundefined
s to the end of the array regardless, without consulting thecompare
function. This is a genuine bug for us NOW because sometimes we sort in reverse order by passing a reversed rank comparison function.See Agoric/agoric-sdk#4252 , which fixed the forward rank comparison so that
sortByRank
applied to it would be consistent. The remaining live problem is only where we use the reversed comparison.The text was updated successfully, but these errors were encountered: