about summary refs log tree commit diff
path: root/tvix/eval/src
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2023-12-13T13·02-0800
committertazjin <tazjin@tvl.su>2023-12-29T21·34+0000
commit9cb3cd10f5159a163ea494f765c583a389324c2d (patch)
treee63224629c9e40874e89fb96338e9230a98f6c5a /tvix/eval/src
parent2883b2d4bd948e090d46cee361bd69d6282d618c (diff)
fix(tvix/eval): propagate catchables through builtins.intersectAttrs r/7276
Change-Id: I4ada8cf10611e98519cb1b1da11bfd06815f2932
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10358
Autosubmit: Adam Joseph <adam@westernsemico.com>
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src')
-rw-r--r--tvix/eval/src/builtins/mod.rs6
-rw-r--r--tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-intersectattrs.exp1
-rw-r--r--tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-intersectattrs.nix1
3 files changed, 8 insertions, 0 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs
index 6ecbb5028471..d75249e94a8b 100644
--- a/tvix/eval/src/builtins/mod.rs
+++ b/tvix/eval/src/builtins/mod.rs
@@ -576,6 +576,12 @@ mod pure_builtins {
 
     #[builtin("intersectAttrs")]
     async fn builtin_intersect_attrs(co: GenCo, x: Value, y: Value) -> Result<Value, ErrorKind> {
+        if x.is_catchable() {
+            return Ok(x);
+        }
+        if y.is_catchable() {
+            return Ok(y);
+        }
         let left_set = x.to_attrs()?;
         if left_set.is_empty() {
             return Ok(Value::attrs(NixAttrs::empty()));
diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-intersectattrs.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-intersectattrs.exp
new file mode 100644
index 000000000000..c508d5366f70
--- /dev/null
+++ b/tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-intersectattrs.exp
@@ -0,0 +1 @@
+false
diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-intersectattrs.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-intersectattrs.nix
new file mode 100644
index 000000000000..cd4d62d05fa2
--- /dev/null
+++ b/tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-intersectattrs.nix
@@ -0,0 +1 @@
+(builtins.tryEval (builtins.intersectAttrs (throw "fred") {})).success