eval: switch up ExprOpConcatLists error position again
This is a minor adjustment to 2b22dae1ba /
I3e9d7c1c7a6599a8e68302448bbb961d051002b7
Basically having the error point to the operand instead of the operator
kind of makes sense, but it would require error spans to *truly* make
sense, and in the meantime maintaining the logic is more hassle than it
is worth.
Change-Id: Idac98dd77a0f4a6cb386cb74e0d4eb5fd2f503e5
This commit is contained in:
@@ -356,12 +356,14 @@ Value ExprOpConcatLists::eval(EvalState & state, Env & env)
|
||||
{
|
||||
state.ctx.stats.nrListConcats++;
|
||||
|
||||
/* We don't call into `concatLists` as that loses the position information of the expressions. */
|
||||
/* We could simply call into `state.concatLists`, but that would add a redundant trace to our errors,
|
||||
* and to fix that we would need to make the error on it and `forceList` optional, and *sigh*
|
||||
*/
|
||||
|
||||
Value v1 = e1->eval(state, env);
|
||||
state.checkList(v1, env, *e1);
|
||||
state.checkList(v1, env, *this); // Pass in `this` instead of `e1` to make the error point to the `++`
|
||||
Value v2 = e2->eval(state, env);
|
||||
state.checkList(v2, env, *e2);
|
||||
state.checkList(v2, env, *this); // Pass in `this` instead of `e2` to make the error point to the `++`
|
||||
|
||||
size_t l1 = v1.listSize(), l2 = v2.listSize(), len = l1 + l2;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
error: expected a list but found an integer: 8
|
||||
at /pwd/in.nix:1:1:
|
||||
at /pwd/in.nix:1:2:
|
||||
1| 8++1
|
||||
| ^
|
||||
| ^
|
||||
2|
|
||||
|
||||
Reference in New Issue
Block a user