fix(tvix): Ensure prim_sort actually uses the right outlist
Previously the outlist would not be used, and it would sort god knows what in the out value. This was probably introduced by the std::vector refactoring, and the language test for builtins.sort was disabled. Whatever reason there was for disabling it seems to be gone, so we're re-enabling it. Change-Id: I98941c2cad78df58ff7bea1ece3aaa4133e94bf8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1757 Reviewed-by: kanepyork <rikingcoding@gmail.com> Tested-by: BuildkiteCI
This commit is contained in:
parent
e458e5255a
commit
1a48f39078
2 changed files with 5 additions and 4 deletions
9
third_party/nix/src/libexpr/primops.cc
vendored
9
third_party/nix/src/libexpr/primops.cc
vendored
|
@ -1600,9 +1600,10 @@ static void prim_sort(EvalState& state, const Pos& pos, Value** args,
|
|||
state.forceList(*args[1], pos);
|
||||
|
||||
// Copy of the input list which can be sorted in place.
|
||||
auto outlist = new NixList(*args[1]->list);
|
||||
v.type = tList;
|
||||
v.list = new NixList(*args[1]->list);
|
||||
|
||||
std::for_each(outlist->begin(), outlist->end(),
|
||||
std::for_each(v.list->begin(), v.list->end(),
|
||||
[&](Value* val) { state.forceValue(*val); });
|
||||
|
||||
auto comparator = [&](Value* a, Value* b) {
|
||||
|
@ -1612,8 +1613,8 @@ static void prim_sort(EvalState& state, const Pos& pos, Value** args,
|
|||
return CompareValues()(a, b);
|
||||
}
|
||||
|
||||
Value vTmp1;
|
||||
Value vTmp2;
|
||||
Value vTmp1{};
|
||||
Value vTmp2{};
|
||||
state.callFunction(*args[0], *a, vTmp1, pos);
|
||||
state.callFunction(vTmp1, *b, vTmp2, pos);
|
||||
return state.forceBool(vTmp2, pos);
|
||||
|
|
Loading…
Reference in a new issue