From cd280e07964db1a789c44748a1a7e5dc4e5d534e Mon Sep 17 00:00:00 2001 From: sterni Date: Mon, 19 Sep 2022 12:03:50 +0200 Subject: fix(tvix/eval): make sure to force before selecting in catAttrs Previously, this would almost always crash because list items are thunked more often nowadays and selecting from a thunk would fail. Also we no longer pop from args, accessing it by index should avoid an unnecessary clone here. Change-Id: I4410c4c2e28cc255a2c7cf2a5322db3d2c556a0e Reviewed-on: https://cl.tvl.fyi/c/depot/+/6693 Reviewed-by: grfn Autosubmit: sterni Tested-by: BuildkiteCI --- tvix/eval/src/tests/tvix_tests/eval-okay-builtins-catAttrs.exp | 1 + tvix/eval/src/tests/tvix_tests/eval-okay-builtins-catAttrs.nix | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-builtins-catAttrs.exp create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-builtins-catAttrs.nix (limited to 'tvix/eval/src/tests') diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-catAttrs.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-catAttrs.exp new file mode 100644 index 000000000000..f8c0b2de5fba --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-catAttrs.exp @@ -0,0 +1 @@ +[ 21 "+" 21 "=" 42 ] diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-catAttrs.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-catAttrs.nix new file mode 100644 index 000000000000..edac76d4461a --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-catAttrs.nix @@ -0,0 +1,10 @@ +builtins.catAttrs "foo" [ + { foo = 21; } + { bar = 23; foo = "+"; } + { } + { bar = 12; } + { foo = 21 + 0; } + { foo = "="; } + ({ bar = 13; } // { baz = 89; }) + { foo = 42; bar = 33; } +] -- cgit 1.4.1