aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-03-16 21:29:52 +0100
committereldritch horrors <pennae@lix.systems>2024-03-16 22:12:49 +0100
commit11f35afa6f7933d1640e55473a8c7a153bf89b14 (patch)
treec8d3755a4237c904cfadc85149d047ca7573962e /doc
parente257ff10fd318a698feebdc2198f45f6af4e3458 (diff)
diagnose duplicated attrs at correct path
diagnose attr duplication at the path the duplication was detected, not at the path the current attribute wanted to place. doing the latter is only correct if a leaf attribute was duplicated, not if an attrpath was set to a non-attrset in one binding and a (potentially implied) attrset in another binding. fixes #124 Change-Id: Ic4aa9cc12a9874d4e7897c6f64408f10aa36fc82
Diffstat (limited to 'doc')
-rw-r--r--doc/manual/rl-next/dup-attr-errors.md22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/manual/rl-next/dup-attr-errors.md b/doc/manual/rl-next/dup-attr-errors.md
new file mode 100644
index 000000000..127c8ceb1
--- /dev/null
+++ b/doc/manual/rl-next/dup-attr-errors.md
@@ -0,0 +1,22 @@
+---
+synopsis: Duplicate attribute reports are more accurate
+# prs: cl 557
+---
+
+Duplicate attribute errors are now more accurate, showing the path at which an error was detected rather than the full, possibly longer, path that caused the error.
+Error reports are now
+```ShellSession
+$ nix eval --expr '{ a.b = 1; a.b.c.d = 1; }'
+error: attribute 'a.b' already defined at «string»:1:3
+ at «string»:1:12:
+ 1| { a.b = 1; a.b.c.d = 1;
+ | ^
+```
+instead of
+```ShellSession
+$ nix eval --expr '{ a.b = 1; a.b.c.d = 1; }'
+error: attribute 'a.b.c.d' already defined at «string»:1:3
+ at «string»:1:12:
+ 1| { a.b = 1; a.b.c.d = 1;
+ | ^
+```