From 5ced8e7292384fc93dd8dad652c2612be4ba5d4a Mon Sep 17 00:00:00 2001 From: Aspen Smith Date: Sat, 10 Feb 2024 10:26:54 -0500 Subject: fix(tvix/eval): Propagate catchables in builtins.groupBy One last place where we needed to wrap the forcing of the element of a list in `try_value!`. This fixes a previously `notyetpassing` test Change-Id: I8827a3e39630e6959013b70bdfa9cbcb93f4e91c Reviewed-on: https://cl.tvl.fyi/c/depot/+/10789 Autosubmit: aspen Reviewed-by: sterni Tested-by: BuildkiteCI --- tvix/eval/src/builtins/mod.rs | 10 ++++++---- .../eval-okay-builtins-group-by-propagate-catchable.exp | 1 + .../eval-okay-builtins-group-by-propagate-catchable.nix | 5 +++++ .../eval-okay-builtins-group-by-propagate-catchable.exp | 1 - .../eval-okay-builtins-group-by-propagate-catchable.nix | 5 ----- 5 files changed, 12 insertions(+), 10 deletions(-) create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-builtins-group-by-propagate-catchable.exp create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-builtins-group-by-propagate-catchable.nix delete mode 100644 tvix/eval/src/tests/tvix_tests/notyetpassing/eval-okay-builtins-group-by-propagate-catchable.exp delete mode 100644 tvix/eval/src/tests/tvix_tests/notyetpassing/eval-okay-builtins-group-by-propagate-catchable.nix (limited to 'tvix/eval') diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs index c070bd44b1..131f2b7bb2 100644 --- a/tvix/eval/src/builtins/mod.rs +++ b/tvix/eval/src/builtins/mod.rs @@ -558,11 +558,13 @@ mod pure_builtins { async fn builtin_group_by(co: GenCo, f: Value, list: Value) -> Result { let mut res: BTreeMap> = BTreeMap::new(); for val in list.to_list()? { - let key = generators::request_force( - &co, - generators::request_call_with(&co, f.clone(), [val.clone()]).await, + let key = try_value!( + generators::request_force( + &co, + generators::request_call_with(&co, f.clone(), [val.clone()]).await, + ) + .await ) - .await .to_str()?; res.entry(key).or_default().push_back(val); diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-group-by-propagate-catchable.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-group-by-propagate-catchable.exp new file mode 100644 index 0000000000..48e341f4d8 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-group-by-propagate-catchable.exp @@ -0,0 +1 @@ +[ false false false ] diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-group-by-propagate-catchable.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-group-by-propagate-catchable.nix new file mode 100644 index 0000000000..182601abb1 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-group-by-propagate-catchable.nix @@ -0,0 +1,5 @@ +map (e: (builtins.tryEval e).success) [ + (builtins.groupBy (builtins.throw "a") [ "" ]) + (builtins.groupBy (x: true) (builtins.throw "b")) + (builtins.groupBy (_: builtins.throw "x") [ "" ]) +] diff --git a/tvix/eval/src/tests/tvix_tests/notyetpassing/eval-okay-builtins-group-by-propagate-catchable.exp b/tvix/eval/src/tests/tvix_tests/notyetpassing/eval-okay-builtins-group-by-propagate-catchable.exp deleted file mode 100644 index 48e341f4d8..0000000000 --- a/tvix/eval/src/tests/tvix_tests/notyetpassing/eval-okay-builtins-group-by-propagate-catchable.exp +++ /dev/null @@ -1 +0,0 @@ -[ false false false ] diff --git a/tvix/eval/src/tests/tvix_tests/notyetpassing/eval-okay-builtins-group-by-propagate-catchable.nix b/tvix/eval/src/tests/tvix_tests/notyetpassing/eval-okay-builtins-group-by-propagate-catchable.nix deleted file mode 100644 index 182601abb1..0000000000 --- a/tvix/eval/src/tests/tvix_tests/notyetpassing/eval-okay-builtins-group-by-propagate-catchable.nix +++ /dev/null @@ -1,5 +0,0 @@ -map (e: (builtins.tryEval e).success) [ - (builtins.groupBy (builtins.throw "a") [ "" ]) - (builtins.groupBy (x: true) (builtins.throw "b")) - (builtins.groupBy (_: builtins.throw "x") [ "" ]) -] -- cgit 1.4.1