Sort primitives explictly. (#2016)

* Sort primitives explictly.

* Write backing up test.
This commit is contained in:
Andrés N. Robalino
2020-06-19 23:34:36 -05:00
committed by GitHub
parent fcbaefed52
commit b0c30098e4
2 changed files with 16 additions and 1 deletions

View File

@ -1,4 +1,5 @@
use crate::commands::WholeStreamCommand;
use crate::data::base::coerce_compare;
use crate::prelude::*;
use nu_errors::ShellError;
use nu_protocol::{Signature, SyntaxShape, UntaggedValue, Value};
@ -112,7 +113,7 @@ pub fn sort(
value: UntaggedValue::Primitive(_),
..
} => {
vec.sort();
vec.sort_by(|a, b| coerce_compare(a, b).expect("Unimplemented BUG: What about primitives that don't have an order defined?").compare());
}
_ => {
let calc_key = |item: &Value| {