feat(tvix/eval): merge attribute sets in bindings

This is a significant step towards correctly implemented nested
bindings. All attribute sets defined within the same binding scope
will now be merged as in Nix, if they use the same key.

Change-Id: I13e056693d5e73192280043c6dd93b47d1306ed6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6800
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
Vincent Ambo 2022-09-28 16:26:57 +03:00 committed by tazjin
parent 0cee44838c
commit cece9eae4a
5 changed files with 133 additions and 13 deletions

View file

@ -0,0 +1 @@
{ set = { a = 1; b = 2; }; }

View file

@ -0,0 +1,9 @@
{
set = {
a = 1;
};
set = {
b = 2;
};
}

View file

@ -0,0 +1 @@
{ set = { a = 21; b = 42; }; }

View file

@ -0,0 +1,12 @@
{
set = rec {
a = 21;
};
set = {
# Fun fact: This might be the only case in Nix where a lexical
# resolution of an identifier can only be resolved by looking at
# *siblings* in the AST.
b = 2 * a;
};
}