fix(tvix/eval): builtins.elemAt: propagate catchables

This commit fixes builtins.elemAt so it propagates catchables like
cppnix does.

Change-Id: Ieca5e128da17e78af0b14dae4a28a1ff8796e4f2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10308
Autosubmit: Adam Joseph <adam@westernsemico.com>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
Adam Joseph 2023-12-12 03:07:52 -08:00 committed by clbot
parent 07ca556a94
commit afba150036
3 changed files with 8 additions and 0 deletions

View file

@ -291,6 +291,12 @@ mod pure_builtins {
#[builtin("elemAt")]
async fn builtin_elem_at(co: GenCo, xs: Value, i: Value) -> Result<Value, ErrorKind> {
if xs.is_catchable() {
return Ok(xs);
}
if i.is_catchable() {
return Ok(i);
}
let xs = xs.to_list()?;
let i = i.as_int()?;
if i < 0 {

View file

@ -0,0 +1 @@
(builtins.tryEval (builtins.elemAt (throw "fred") 0)).success