diff options
author | Griffin Smith <root@gws.fyi> | 2022-10-23T17·37-0400 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-10-29T10·45+0000 |
commit | d0a836b0e1ee1034144d1e5b71df6ab285c8450e (patch) | |
tree | 73fd2ee2803af3d0a1617e7da3769cd5076091dd /tvix/eval/src/builtins | |
parent | b8a7dba709436eeb562f8911ae1b5691830d6fd7 (diff) |
feat(tvix/eval): Implement comparison for lists r/5221
Lists are compared lexicographically in C++ nix as of [0], and our updated nix test suites depend on this. This implements comparison of list values in `Value::nix_cmp` using a very similar algorithm to what C++ does - similarly to there, this requires passing in the VM so we can force thunks in the list elements as we go. [0]: https://github.com/NixOS/nix/commit/09471d2680292af48b2788108de56a8da755d661# Change-Id: I5d8bb07f90647a1fec83f775243e21af856afbb1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7070 Autosubmit: grfn <grfn@gws.fyi> Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/builtins')
-rw-r--r-- | tvix/eval/src/builtins/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs index ea431977bdb6..5c029605f1ec 100644 --- a/tvix/eval/src/builtins/mod.rs +++ b/tvix/eval/src/builtins/mod.rs @@ -418,7 +418,7 @@ fn pure_builtins() -> Vec<Builtin> { &[false, false], |args: Vec<Value>, vm: &mut VM| { Ok(Value::Bool(matches!( - args[0].force(vm)?.nix_cmp(&*args[1].force(vm)?)?, + args[0].force(vm)?.nix_cmp(&*args[1].force(vm)?, vm)?, Some(Ordering::Less) ))) }, |