diff options
author | eldritch horrors <pennae@lix.systems> | 2024-03-16 21:29:52 +0100 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-03-16 22:12:49 +0100 |
commit | 11f35afa6f7933d1640e55473a8c7a153bf89b14 (patch) | |
tree | c8d3755a4237c904cfadc85149d047ca7573962e /tests | |
parent | e257ff10fd318a698feebdc2198f45f6af4e3458 (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 'tests')
6 files changed, 18 insertions, 0 deletions
diff --git a/tests/functional/lang/eval-fail-dupAttr-deep.err.exp b/tests/functional/lang/eval-fail-dupAttr-deep.err.exp new file mode 100644 index 000000000..bb79605c0 --- /dev/null +++ b/tests/functional/lang/eval-fail-dupAttr-deep.err.exp @@ -0,0 +1,5 @@ +error: attribute 'a.b.c' already defined at /pwd/lang/eval-fail-dupAttr-deep.nix:1:3 + at /pwd/lang/eval-fail-dupAttr-deep.nix:1:14: + 1| { a.b.c = 1; a.b.c.a.a = 1; } + | ^ + 2| diff --git a/tests/functional/lang/eval-fail-dupAttr-deep.nix b/tests/functional/lang/eval-fail-dupAttr-deep.nix new file mode 100644 index 000000000..186a7f705 --- /dev/null +++ b/tests/functional/lang/eval-fail-dupAttr-deep.nix @@ -0,0 +1 @@ +{ a.b.c = 1; a.b.c.a.a = 1; } diff --git a/tests/functional/lang/eval-fail-dupAttr-inherit.err.exp b/tests/functional/lang/eval-fail-dupAttr-inherit.err.exp new file mode 100644 index 000000000..7744b838f --- /dev/null +++ b/tests/functional/lang/eval-fail-dupAttr-inherit.err.exp @@ -0,0 +1,5 @@ +error: attribute 'a' already defined at /pwd/lang/eval-fail-dupAttr-inherit.nix:1:15 + at /pwd/lang/eval-fail-dupAttr-inherit.nix:1:19: + 1| { inherit ({}) a; a.b = 1; } + | ^ + 2| diff --git a/tests/functional/lang/eval-fail-dupAttr-inherit.nix b/tests/functional/lang/eval-fail-dupAttr-inherit.nix new file mode 100644 index 000000000..cb8e4e625 --- /dev/null +++ b/tests/functional/lang/eval-fail-dupAttr-inherit.nix @@ -0,0 +1 @@ +{ inherit ({}) a; a.b = 1; } diff --git a/tests/functional/lang/eval-fail-dupAttr.err.exp b/tests/functional/lang/eval-fail-dupAttr.err.exp new file mode 100644 index 000000000..567791959 --- /dev/null +++ b/tests/functional/lang/eval-fail-dupAttr.err.exp @@ -0,0 +1,5 @@ +error: attribute 'a' already defined at /pwd/lang/eval-fail-dupAttr.nix:1:3 + at /pwd/lang/eval-fail-dupAttr.nix:1:10: + 1| { a = 1; a.b = 1; } + | ^ + 2| diff --git a/tests/functional/lang/eval-fail-dupAttr.nix b/tests/functional/lang/eval-fail-dupAttr.nix new file mode 100644 index 000000000..a33535e62 --- /dev/null +++ b/tests/functional/lang/eval-fail-dupAttr.nix @@ -0,0 +1 @@ +{ a = 1; a.b = 1; } |