diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-04-01T10·55+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-04-01T10·55+0000 |
commit | 95cc417d76f7d374ef63e0b49a2f83e7b9202b0c (patch) | |
tree | fbd21bcd0a6558c2498c765007e99201ec08359d /src/libexpr/eval.cc | |
parent | 71f026292ba1b401237a16ab6e0fb57c36c93df5 (diff) |
* Functions are incomparable.
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r-- | src/libexpr/eval.cc | 19 |
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)); } |