From 5bda6d9dc897bf60be4025cac418dcbdd835bf3c Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Mon, 4 Mar 2024 09:14:11 +0100 Subject: [PATCH] Merge pull request #9915 from 9999years/evaluating-attribute-position Add position information to `while evaluating the attribute` errors in the debugger (cherry picked from commit ffe67c86a8ef3695e5c8b9c9800c192ac633dded) Change-Id: I177ea5ec60898abe09fb9d80d9602b2a32ff8f44 --- ...-location-in-while-evaluating-attribute.md | 23 +++++++++++++++++++ src/libexpr/eval.cc | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 doc/manual/rl-next/source-location-in-while-evaluating-attribute.md diff --git a/doc/manual/rl-next/source-location-in-while-evaluating-attribute.md b/doc/manual/rl-next/source-location-in-while-evaluating-attribute.md new file mode 100644 index 000000000..0e0b74c5a --- /dev/null +++ b/doc/manual/rl-next/source-location-in-while-evaluating-attribute.md @@ -0,0 +1,23 @@ +--- +synopsis: "In the debugger, `while evaluating the attribute` errors now include position information" +prs: 9915 +--- + +Before: + +``` +0: while evaluating the attribute 'python311.pythonForBuild.pkgs' +0x600001522598 +``` + +After: + +``` +0: while evaluating the attribute 'python311.pythonForBuild.pkgs' +/nix/store/hg65h51xnp74ikahns9hyf3py5mlbbqq-source/overrides/default.nix:132:27 + + 131| + 132| bootstrappingBase = pkgs.${self.python.pythonAttr}.pythonForBuild.pkgs; + | ^ + 133| in +``` diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 565688868..debeaf75f 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -1457,7 +1457,7 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v) state, *this, env, - state.positions[pos2], + state.positions[getPos()], "while evaluating the attribute '%1%'", showAttrPath(state, env, attrPath)) : nullptr;