about summary refs log tree commit diff
path: root/tvix/eval/src/tests/tvix_tests/eval-okay-attrs-inherit-literal.nix
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-14T17·12+0300
committertazjin <tazjin@tvl.su>2022-08-31T22·10+0000
commit8c1c9aee3cab52befe55d6f41e1c9acaef1b1843 (patch)
tree471f85e3422840b7e9d3d87d9c47b26be3ca57c1 /tvix/eval/src/tests/tvix_tests/eval-okay-attrs-inherit-literal.nix
parent7db4f8d7747cf1c4a40fdf399a36aa9d59d92792 (diff)
feat(tvix/eval): implement `inherit` in attribute set literals r/4548
Straightforward implementation, evaluating the elements of an inherit
and preparing the stack so that `OpAttrs` sees all relevant values
when constructing the attribute set itself.

The emitted instructions for inheriting a lot of values from the same
attribute set are inefficient, but it's too early to say whether this
actually matters.

Change-Id: Icb55a20936d4ef77173f34433811c5fa5d2c9ecc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6214
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/tests/tvix_tests/eval-okay-attrs-inherit-literal.nix')
-rw-r--r--tvix/eval/src/tests/tvix_tests/eval-okay-attrs-inherit-literal.nix2
1 files changed, 2 insertions, 0 deletions
diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-attrs-inherit-literal.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-attrs-inherit-literal.nix
new file mode 100644
index 000000000000..587aec893372
--- /dev/null
+++ b/tvix/eval/src/tests/tvix_tests/eval-okay-attrs-inherit-literal.nix
@@ -0,0 +1,2 @@
+# the 'from' part of an `inherit` can be any expression.
+{ inherit ({a = 15;}) a; }.a