about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libexpr/eval.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 4277c65ea7b9..53e57ff0894f 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -69,16 +69,17 @@ std::ostream & operator << (std::ostream & str, Value & v)
 string showType(Value & v)
 {
     switch (v.type) {
-        case tString: return "a string";
-        case tPath: return "a path";
-        case tNull: return "null";
         case tInt: return "an integer";
         case tBool: return "a boolean";
-        case tLambda: return "a function";
+        case tString: return "a string";
+        case tPath: return "a path";
         case tAttrs: return "an attribute set";
         case tList: return "a list";
+        case tNull: return "null";
+        case tLambda: return "a function";
+        case tPrimOp: return "a built-in function";
         case tPrimOpApp: return "a partially applied built-in function";
-        default: throw Error("unknown type");
+        default: throw Error(format("unknown type: %1%") % v.type);
     }
 }
 
@@ -299,7 +300,7 @@ void EvalState::eval(Env & env, Expr e, Value & v)
     char x;
     if (&x < deepestStack) deepestStack = &x;
     
-    debug(format("eval: %1%") % e);
+    //debug(format("eval: %1%") % e);
 
     nrEvaluated++;
 
@@ -864,6 +865,12 @@ bool EvalState::eqValues(Value & v1, Value & v2)
             return true;
         }
 
+        /* Functions are incomparable. */
+        case tLambda:
+        case tPrimOp:
+        case tPrimOpApp:
+            return false;
+
         default:
             throw Error(format("cannot compare %1% with %2%") % showType(v1) % showType(v2));
     }