diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index f66b24b770..149c7ca399 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -183,8 +183,8 @@ static void prim_genericClosure(EvalState & state, Value * * args, Value & v) list res; set doneKeys; // !!! use Value *? while (!workSet.empty()) { - Value * e = *(workSet.begin()); - workSet.pop_front(); + Value * e = *(workSet.begin()); + workSet.pop_front(); state.forceAttrs(*e); @@ -1032,7 +1032,10 @@ static void prim_div(EvalState & state, Value * * args, Value & v) static void prim_lessThan(EvalState & state, Value * * args, Value & v) { - mkBool(v, state.forceInt(*args[0]) < state.forceInt(*args[1])); + state.forceValue(*args[0]); + state.forceValue(*args[1]); + CompareValues comp; + mkBool(v, comp(*args[0], *args[1])); } diff --git a/tests/lang/eval-okay-arithmetic.exp b/tests/lang/eval-okay-arithmetic.exp index d73ac3eb70..b195055b7a 100644 --- a/tests/lang/eval-okay-arithmetic.exp +++ b/tests/lang/eval-okay-arithmetic.exp @@ -1 +1 @@ -2185 +2188 diff --git a/tests/lang/eval-okay-arithmetic.nix b/tests/lang/eval-okay-arithmetic.nix index 62a0ada065..8f307b20ea 100644 --- a/tests/lang/eval-okay-arithmetic.nix +++ b/tests/lang/eval-okay-arithmetic.nix @@ -50,6 +50,11 @@ let { (if 2 > 1 == 1 < 2 then 1 else err) (if 1 + 2 * 3 >= 7 then 1 else err) (if 1 + 2 * 3 < 7 then err else 1) + + # Not integer, but so what. + (if "aa" < "ab" then 1 else err) + (if "aa" < "aa" then err else 1) + (if "foo" < "foobar" then 1 else err) ]; }