From 4ce8d809ea6cd01b99c60008cd360667969f94ec Mon Sep 17 00:00:00 2001 From: piegames Date: Thu, 20 Nov 2025 19:22:44 +0100 Subject: [PATCH] libexpr/parser: Fix small error position mistake In one of the cases it pointed to the first instead of the second occurence, which is a bit confusing Change-Id: Ie508d1f84feb434708804d45aa8a9c8b1e3c5f69 --- lix/libexpr/parser/state.hh | 2 +- .../lang/parser-merge-attrs/parse-fail-err1.err.exp | 8 ++++---- .../lang/parser-merge-attrs/parse-fail-err2.err.exp | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lix/libexpr/parser/state.hh b/lix/libexpr/parser/state.hh index af2e0eb37..ec2ee580b 100644 --- a/lix/libexpr/parser/state.hh +++ b/lix/libexpr/parser/state.hh @@ -177,7 +177,7 @@ inline void State::addAttr(ExprAttrs * attrs, AttrPath && attrPath, std::unique_ for (auto & ad : ae->attrs) { auto j2 = jAttrs->attrs.find(ad.first); if (j2 != jAttrs->attrs.end()) // Attr already defined in iAttrs, error. - return dupAttr(ad.first, j2->second.pos, ad.second.pos); + return dupAttr(ad.first, ad.second.pos, j2->second.pos); if (ad.second.kind == ExprAttrs::AttrDef::Kind::InheritedFrom) { auto & sel = dynamic_cast(*ad.second.e); auto & from = dynamic_cast(*sel.e); diff --git a/tests/functional2/lang/parser-merge-attrs/parse-fail-err1.err.exp b/tests/functional2/lang/parser-merge-attrs/parse-fail-err1.err.exp index d65abb1ed..d8094c526 100644 --- a/tests/functional2/lang/parser-merge-attrs/parse-fail-err1.err.exp +++ b/tests/functional2/lang/parser-merge-attrs/parse-fail-err1.err.exp @@ -1,6 +1,6 @@ -error: attribute 'z' already defined at /pwd/in.nix:3:16 - at /pwd/in.nix:2:3: - 1| { +error: attribute 'z' already defined at /pwd/in.nix:2:3 + at /pwd/in.nix:3:16: 2| x.z = 3; - | ^ 3| x = { y = 3; z = 3; }; + | ^ + 4| } diff --git a/tests/functional2/lang/parser-merge-attrs/parse-fail-err2.err.exp b/tests/functional2/lang/parser-merge-attrs/parse-fail-err2.err.exp index 097ae785d..a95be6807 100644 --- a/tests/functional2/lang/parser-merge-attrs/parse-fail-err2.err.exp +++ b/tests/functional2/lang/parser-merge-attrs/parse-fail-err2.err.exp @@ -1,6 +1,6 @@ -error: attribute 'y' already defined at /pwd/in.nix:3:9 - at /pwd/in.nix:2:3: - 1| { +error: attribute 'y' already defined at /pwd/in.nix:2:3 + at /pwd/in.nix:3:9: 2| x.y.y = 3; - | ^ 3| x = { y.y= 3; z = 3; }; + | ^ + 4| }