From c5f58d4af3eb47e6474a8793973889eca05f7978 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Tue, 12 Dec 2023 04:27:05 -0800 Subject: fix(tvix/eval): baseNameOf: propagate catchables Change-Id: Id8dc772ea8f338dfd243210f4108f79072570c3b Reviewed-on: https://cl.tvl.fyi/c/depot/+/10324 Autosubmit: Adam Joseph Tested-by: BuildkiteCI Reviewed-by: tazjin --- tvix/eval/src/builtins/mod.rs | 1 + .../src/tests/tvix_tests/eval-okay-basenameof-propagate-catchables.exp | 1 + .../src/tests/tvix_tests/eval-okay-basenameof-propagate-catchables.nix | 1 + 3 files changed, 3 insertions(+) create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-basenameof-propagate-catchables.exp create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-basenameof-propagate-catchables.nix (limited to 'tvix') diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs index c2618a4066f4..554fc9d7e329 100644 --- a/tvix/eval/src/builtins/mod.rs +++ b/tvix/eval/src/builtins/mod.rs @@ -135,6 +135,7 @@ mod pure_builtins { async fn builtin_base_name_of(co: GenCo, s: Value) -> Result { let span = generators::request_span(&co).await; let s = match s { + val @ Value::Catchable(_) => return Ok(val), // it is important that builtins.baseNameOf does not // coerce paths into strings, since this will turn them // into store paths, and `builtins.baseNameOf diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-basenameof-propagate-catchables.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-basenameof-propagate-catchables.exp new file mode 100644 index 000000000000..c508d5366f70 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-basenameof-propagate-catchables.exp @@ -0,0 +1 @@ +false diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-basenameof-propagate-catchables.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-basenameof-propagate-catchables.nix new file mode 100644 index 000000000000..f47c6f22bbe3 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-basenameof-propagate-catchables.nix @@ -0,0 +1 @@ +(builtins.tryEval ( builtins.baseNameOf (throw "jill") )).success -- cgit 1.4.1