Revert the behaviour of antiquoted paths to pre-Nix 1.6

Commit 159e621d1a accidentally changed
the behaviour of antiquoted paths, e.g.

  "${/foo}/bar"

used to evaluate to "/nix/store/<hash>-foo/bar" (where /foo gets
copied to the store), but in Nix 1.6 it evaluates to "/foo/bar".  This
is inconsistent, since

  " ${/foo}/bar"

evaluates to " /nix/store/<hash>-foo/bar".  So revert to the old
behaviour.
This commit is contained in:
Eelco Dolstra 2013-10-17 00:39:59 +02:00
parent b8571d68c4
commit d6a7aa8f48

View file

@ -959,8 +959,8 @@ void ExprConcatStrings::eval(EvalState & state, Env & env, Value & v)
std::ostringstream s; std::ostringstream s;
NixInt n = 0; NixInt n = 0;
bool first = true; bool first = !forceString;
ValueType firstType; ValueType firstType = tString;
foreach (vector<Expr *>::iterator, i, *es) { foreach (vector<Expr *>::iterator, i, *es) {
Value vTmp; Value vTmp;
@ -975,12 +975,12 @@ void ExprConcatStrings::eval(EvalState & state, Env & env, Value & v)
first = false; first = false;
} }
if (firstType == tInt && !forceString) { if (firstType == tInt) {
if (vTmp.type != tInt) if (vTmp.type != tInt)
throwEvalError("cannot add %1% to an integer", showType(vTmp)); throwEvalError("cannot add %1% to an integer", showType(vTmp));
n += vTmp.integer; n += vTmp.integer;
} else } else
s << state.coerceToString(vTmp, context, false, firstType != tPath); s << state.coerceToString(vTmp, context, false, firstType == tString);
} }
if (firstType == tInt) if (firstType == tInt)