forked from lix-project/lix
* Allow unsafe (unspecified) comparisons between attrsets unless
NIX_NO_UNSAFE_EQ is set, for now.
This commit is contained in:
parent
c34e6d71bc
commit
50d11b90ca
|
@ -23,6 +23,8 @@ EvalState::EvalState()
|
||||||
initNixExprHelpers();
|
initNixExprHelpers();
|
||||||
|
|
||||||
addPrimOps();
|
addPrimOps();
|
||||||
|
|
||||||
|
allowUnsafeEquality = getEnv("NIX_NO_UNSAFE_EQ", "") == "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -661,9 +663,13 @@ LocalNoInline(bool areEqual(EvalState & state, Expr e1, Expr e2))
|
||||||
/* Functions are incomparable. */
|
/* Functions are incomparable. */
|
||||||
if (sym1 == symFunction || sym1 == symPrimOp) return false;
|
if (sym1 == symFunction || sym1 == symPrimOp) return false;
|
||||||
|
|
||||||
if (sym1 == symAttrs)
|
if (!state.allowUnsafeEquality && sym1 == symAttrs)
|
||||||
throw EvalError("comparison of attribute sets is not implemented");
|
throw EvalError("comparison of attribute sets is not implemented");
|
||||||
|
|
||||||
|
/* !!! This allows comparisons of infinite data structures to
|
||||||
|
succeed, such as `let x = [x]; in x == x'. This is
|
||||||
|
undesirable, since equivalent (?) terms such as `let x = [x]; y
|
||||||
|
= [y]; in x == y' don't terminate. */
|
||||||
if (e1 == e2) return true;
|
if (e1 == e2) return true;
|
||||||
|
|
||||||
if (sym1 == symList) {
|
if (sym1 == symList) {
|
||||||
|
|
|
@ -38,6 +38,8 @@ struct EvalState
|
||||||
unsigned int nrEvaluated;
|
unsigned int nrEvaluated;
|
||||||
unsigned int nrCached;
|
unsigned int nrCached;
|
||||||
|
|
||||||
|
bool allowUnsafeEquality;
|
||||||
|
|
||||||
EvalState();
|
EvalState();
|
||||||
|
|
||||||
void addPrimOps();
|
void addPrimOps();
|
||||||
|
|
Loading…
Reference in a new issue