Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(libexpr/eval-inline): get rid of references to nullptr env #11881

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/libexpr/eval-inline.hh
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,22 @@ void EvalState::forceValue(Value & v, const PosIdx pos)
{
if (v.isThunk()) {
Env * env = v.payload.thunk.env;
assert(env || v.isBlackhole());
Expr * expr = v.payload.thunk.expr;
try {
v.mkBlackhole();
//checkInterrupt();
expr->eval(*this, *env, v);
if (env) [[likely]] {
expr->eval(*this, *env, v);
} else {
// NOTE: This is necessary in order to avoid forming references to nullptr
// when the value is already a blackhole. This should always throw an
// InfiniteRecursionError.
// TBD: Maybe this case be handled directly without an idirection and a dummy
Mic92 marked this conversation as resolved.
Show resolved Hide resolved
// environment (which isn't accesses anyway)?
Env dummyEnv;
expr->eval(*this, dummyEnv, v);
}
} catch (...) {
v.mkThunk(env, expr);
tryFixupBlackHolePos(v, pos);
Expand Down
Loading