diff options
author | Adam Joseph <adam@westernsemico.com> | 2023-12-13T13·02-0800 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2023-12-29T21·34+0000 |
commit | 9cb3cd10f5159a163ea494f765c583a389324c2d (patch) | |
tree | e63224629c9e40874e89fb96338e9230a98f6c5a /tvix/eval/src | |
parent | 2883b2d4bd948e090d46cee361bd69d6282d618c (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')
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 |