* 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
1 changed files with 8 additions and 2 deletions

View File

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