From 2ea71aa4c39ff6b200e06f626aaacf8100c19a78 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 14 Aug 2022 02:24:02 +0300 Subject: fix(tvix/eval): `null` in dynamic attribute keys skips the element 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 Tested-by: BuildkiteCI --- tvix/eval/src/value/attrs.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tvix/eval/src/value/attrs.rs') diff --git a/tvix/eval/src/value/attrs.rs b/tvix/eval/src/value/attrs.rs index 1b76eb1966..a6dfd383d7 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(), -- cgit 1.4.1