From 7e048eddf55637b9e81d704f6b9f1fdeca98a5ea Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 8 Apr 2010 11:25:14 +0000 Subject: [PATCH] * 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. --- src/libexpr/eval.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 98b6b7bdd..e72538e60 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -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);