about summary refs log tree commit diff
path: root/tvix/eval
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-13T23·24+0300
committertazjin <tazjin@tvl.su>2022-08-30T16·53+0000
commit2ea71aa4c39ff6b200e06f626aaacf8100c19a78 (patch)
tree24e49b83a2ce8c73e42db30b86f796f272fd1e77 /tvix/eval
parente041851581743757b9b6a7fb2844229e1735d3b4 (diff)
fix(tvix/eval): `null` in dynamic attribute keys skips the element r/4535
This is actually *tested* behaviour in C++ Nix, so we need to
implement it here, too.

Change-Id: Ic4a4659a2f04cdd928cbe78a85dae90401515371
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6199
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval')
-rw-r--r--tvix/eval/src/value/attrs.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/tvix/eval/src/value/attrs.rs b/tvix/eval/src/value/attrs.rs
index 1b76eb1966d3..a6dfd383d74a 100644
--- a/tvix/eval/src/value/attrs.rs
+++ b/tvix/eval/src/value/attrs.rs
@@ -203,6 +203,13 @@ impl NixAttrs {
                     )?;
                 }
 
+                Value::Null => {
+                    // This is in fact valid, but leads to the value
+                    // being ignored and nothing being set, i.e. `{
+                    // ${null} = 1; } => { }`.
+                    continue;
+                }
+
                 other => {
                     return Err(Error::InvalidKeyType {
                         given: other.type_of(),