diff options
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 58fe6bbbcb0c..8ae0ae02d6ad 100644 --- a/tvix/eval/src/builtins/mod.rs +++ b/tvix/eval/src/builtins/mod.rs @@ -466,6 +466,12 @@ mod pure_builtins { #[builtin("getAttr")] async fn builtin_get_attr(co: GenCo, key: Value, set: Value) -> Result<Value, ErrorKind> { + if key.is_catchable() { + return Ok(key); + } + if set.is_catchable() { + return Ok(set); + } let k = key.to_str()?; let xs = set.to_attrs()?; diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-getAttr-catchable.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-getAttr-catchable.exp new file mode 100644 index 000000000000..c508d5366f70 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-getAttr-catchable.exp @@ -0,0 +1 @@ +false diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-getAttr-catchable.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-getAttr-catchable.nix new file mode 100644 index 000000000000..ef4a042ffb83 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-getAttr-catchable.nix @@ -0,0 +1 @@ +(builtins.tryEval (builtins.getAttr (throw "fred") "bob")).success |