-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
report inherit attr errors at the duplicate name
previously we reported the error at the beginning of the binding block (for plain inherits) or the beginning of the attr list (for inherit-from), effectively hiding where exactly the error happened. this also carries over to runtime positions of attributes in sets as reported by unsafeGetAttrPos. we're not worried about this changing observable eval behavior because it *is* marked unsafe, and the new behavior is much more useful.
- Loading branch information
Showing
8 changed files
with
42 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
synopsis: fix duplicate attribute error positions for `inherit` | ||
prs: 9874 | ||
--- | ||
|
||
When an inherit caused a duplicate attribute error the position of the error was not reported correctly, placing the error with the inherit itself or at the start of the bindings block instead of the offending attribute name. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[ { column = 17; file = "/pwd/lang/eval-okay-inherit-attr-pos.nix"; line = 4; } { column = 19; file = "/pwd/lang/eval-okay-inherit-attr-pos.nix"; line = 4; } { column = 21; file = "/pwd/lang/eval-okay-inherit-attr-pos.nix"; line = 5; } { column = 23; file = "/pwd/lang/eval-okay-inherit-attr-pos.nix"; line = 5; } ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
let | ||
d = 0; | ||
x = 1; | ||
y = { inherit d x; }; | ||
z = { inherit (y) d x; }; | ||
in | ||
[ | ||
(builtins.unsafeGetAttrPos "d" y) | ||
(builtins.unsafeGetAttrPos "x" y) | ||
(builtins.unsafeGetAttrPos "d" z) | ||
(builtins.unsafeGetAttrPos "x" z) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
error: attribute 'x' already defined at «stdin»:9:5 | ||
at «stdin»:10:17: | ||
at «stdin»:10:18: | ||
9| x = 789; | ||
10| inherit (as) x; | ||
| ^ | ||
| ^ | ||
11| }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
error: attribute 'x' already defined at «stdin»:9:5 | ||
at «stdin»:10:17: | ||
at «stdin»:10:18: | ||
9| x = 789; | ||
10| inherit (as) x; | ||
| ^ | ||
| ^ | ||
11| }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
error: attribute 'x' already defined at «stdin»:6:12 | ||
at «stdin»:7:12: | ||
error: attribute 'x' already defined at «stdin»:6:13 | ||
at «stdin»:7:13: | ||
6| inherit x; | ||
7| inherit x; | ||
| ^ | ||
| ^ | ||
8| }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
error: undefined variable 'gcc' | ||
at «stdin»:8:12: | ||
7| | ||
at «stdin»:9:13: | ||
8| body = ({ | ||
| ^ | ||
9| inherit gcc; | ||
| ^ | ||
10| }).gcc; |