diff options
author | Adam Joseph <adam@westernsemico.com> | 2023-12-13T13·53-0800 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2023-12-29T21·34+0000 |
commit | 4b3f27ebc91c34c4a6a33d164e4d9f5fc975a48e (patch) | |
tree | 48c977b8dd0ee7ac0f1a16f94a21fe99245f47c0 /tvix/eval/src | |
parent | 9cb3cd10f5159a163ea494f765c583a389324c2d (diff) |
fix(tvix/eval): propagate catchables through builtins.attrNames r/7277
Change-Id: Id14e39543239272aed041998fd9a78465c9cb8b2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10359 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.rs | 3 | ||||
-rw-r--r-- | tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-attrNames.exp | 1 | ||||
-rw-r--r-- | tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-attrNames.nix | 1 |
3 files changed, 5 insertions, 0 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs index d75249e94a8b..341ee6096924 100644 --- a/tvix/eval/src/builtins/mod.rs +++ b/tvix/eval/src/builtins/mod.rs @@ -121,6 +121,9 @@ mod pure_builtins { #[builtin("attrNames")] async fn builtin_attr_names(co: GenCo, set: Value) -> Result<Value, ErrorKind> { + if set.is_catchable() { + return Ok(set); + } let xs = set.to_attrs()?; let mut output = Vec::with_capacity(xs.len()); diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-attrNames.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-attrNames.exp new file mode 100644 index 000000000000..c508d5366f70 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-attrNames.exp @@ -0,0 +1 @@ +false diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-attrNames.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-attrNames.nix new file mode 100644 index 000000000000..75531d56a381 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-attrNames.nix @@ -0,0 +1 @@ +(builtins.tryEval (builtins.attrNames (throw "fred"))).success |