* Fix blackholing. If evaluation fails due to an assertion failure,

then the blackhole has to be removed to ensure that repeated
  evaluation of the same value gives an assertion failure again rather
  than an "infinite recursion" error.
This commit is contained in:
Eelco Dolstra 2010-04-08 11:25:14 +00:00
parent af2a372bb0
commit 7e048eddf5

View file

@ -681,8 +681,14 @@ bool EvalState::evalBool(Env & env, Expr e)
void EvalState::forceValue(Value & v) void EvalState::forceValue(Value & v)
{ {
if (v.type == tThunk) { if (v.type == tThunk) {
//v.type = tBlackhole; ValueType saved = v.type;
try {
v.type = tBlackhole;
eval(*v.thunk.env, v.thunk.expr, v); eval(*v.thunk.env, v.thunk.expr, v);
} catch (Error & e) {
v.type = saved;
throw;
}
} }
else if (v.type == tCopy) { else if (v.type == tCopy) {
forceValue(*v.val); forceValue(*v.val);