diff --git a/lix/libexpr/parser/state.hh b/lix/libexpr/parser/state.hh index 8759709ac..cf3d807a5 100644 --- a/lix/libexpr/parser/state.hh +++ b/lix/libexpr/parser/state.hh @@ -217,7 +217,8 @@ inline void State::mergeAttrs(AttrPath & attrPath, ExprSet * source, ExprSet * t if (auto collision = target->attrs.find(insertKey); collision != target->attrs.end()) // Attr already defined in target, error. { - return dupAttr(insertKey, insertDef.pos, collision->second.pos); + attrPath.push_back(AttrName(insertDef.pos, insertKey)); + return dupAttr(attrPath, insertDef.pos, collision->second.pos); } if (insertDef.kind == ExprAttrs::AttrDef::Kind::InheritedFrom) { auto & sel = dynamic_cast(*insertDef.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 d8094c526..1fb991c4a 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,4 +1,4 @@ -error: attribute 'z' already defined at /pwd/in.nix:2:3 +error: attribute 'x.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; }; 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 a95be6807..cfcf40eaa 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,4 +1,4 @@ -error: attribute 'y' already defined at /pwd/in.nix:2:3 +error: attribute 'x.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; };