1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 10:31:15 +02:00

use singleton expr to generate black hole errors

this also reduces forceValue code size and removes the need for
hideInDiagnostics. coopting thunk forcing like this has the additional
benefit of clarifying how these errors can happen in the first place.
This commit is contained in:
pennae 2023-12-11 16:23:08 +01:00
parent f9db4de0f3
commit 2b0e95e7aa
8 changed files with 51 additions and 61 deletions

View file

@ -61,6 +61,7 @@ class Bindings;
struct Env;
struct Expr;
struct ExprLambda;
struct ExprBlackHole;
struct PrimOp;
class Symbol;
class PosIdx;
@ -442,16 +443,17 @@ public:
};
extern Value prim_blackHole;
extern ExprBlackHole eBlackHole;
inline bool Value::isBlackhole() const
bool Value::isBlackhole() const
{
return internalType == tApp && app.left == &prim_blackHole;
return internalType == tThunk && thunk.expr == (Expr*) &eBlackHole;
}
inline void Value::mkBlackhole()
void Value::mkBlackhole()
{
mkApp(&prim_blackHole, &prim_blackHole);
internalType = tThunk;
thunk.expr = (Expr*) &eBlackHole;
}