fetchClosure: Disallow toPath for inputAddressed = true

This commit is contained in:
Robert Hensing 2023-06-05 11:11:53 +02:00
parent 508aa58e67
commit 8dca95386c

View file

@ -58,12 +58,11 @@ static void prim_fetchClosure(EvalState & state, const PosIdx pos, Value * * arg
bool inputAddressed = inputAddressedMaybe.value_or(false); bool inputAddressed = inputAddressedMaybe.value_or(false);
if (inputAddressed) { if (inputAddressed) {
if (toPath && toPath != fromPath) if (toPath)
throw Error({ throw Error({
.msg = hintfmt("attribute '%s' is set to true, but 'toPath' does not match 'fromPath'. 'toPath' should be equal, or should be omitted. Instead 'toPath' was '%s' and 'fromPath' was '%s'", .msg = hintfmt("attribute '%s' is set to true, but '%s' is also set. Please remove one of them",
"inputAddressed", "inputAddressed",
state.store->printStorePath(*toPath), "toPath"),
state.store->printStorePath(*fromPath)),
.errPos = state.positions[pos] .errPos = state.positions[pos]
}); });
assert(!enableRewriting); assert(!enableRewriting);