-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nixd/Sema: add lowering support for attrs
- Loading branch information
Showing
7 changed files
with
192 additions
and
29 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
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,7 @@ | ||
# RUN: true | ||
|
||
# FIXME: we cannot deal with string_parts currently | ||
# rewrite this test after we can do such thing. | ||
{ | ||
"${bar}" = 1; | ||
} |
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,7 @@ | ||
# RUN: nixd-lint %s | FileCheck %s | ||
{ | ||
inherit aa; | ||
|
||
# CHECK: duplicated attr `aa` | ||
aa = 1; | ||
} |
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,10 @@ | ||
# RUN: nixd-lint %s | FileCheck %s | ||
{ | ||
a.bbb = 1; | ||
|
||
# CHECK: error: duplicated attr `b` | ||
a.bbb.c = 2; | ||
|
||
# CHECK: duplicated attr `a` | ||
a = 3; | ||
} |
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,10 @@ | ||
# RUN: nixd-lint %s | FileCheck %s | ||
{ | ||
foo.bar = 1; | ||
|
||
# CHECK: merging nested `rec` attributes, nested `rec` will be implictly ignored | ||
foo = rec { | ||
x = 1; | ||
y = x; | ||
}; | ||
} |
12 changes: 12 additions & 0 deletions
12
nixd/tools/nixd-lint/test/lowering-attrset-select-merging.nix
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 @@ | ||
# RUN: nixd-lint -dump-nix-ast %s | FileCheck %s | ||
|
||
# CHECK: ExprAttrs: { a = { b = 1; c = 2; }; x = 1; } | ||
{ | ||
# CHECK: ExprAttrs: { b = 1; c = 2; } | ||
a.b = 1; | ||
a.c = 2; | ||
|
||
a = { | ||
x = 1; | ||
}; | ||
} |