diff options
author | Adam Joseph <adam@westernsemico.com> | 2023-12-13T05·18-0800 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2023-12-29T21·34+0000 |
commit | 7ddea7340f547166a3c3f7fdd0afa776d9ba35aa (patch) | |
tree | e5a2026ccdc1bc0c53ad3cc30818f131ce5cb4a0 /tvix/eval/src/builtins | |
parent | 2af8174e2e36d4c96f612e92b3e00c3330fb56fa (diff) |
fix(tvix/eval): catchable in type field of nix_eq() r/7274
Change-Id: I165ff77764e272cc94d18cb03ad6cbc9a8ebefde Reviewed-on: https://cl.tvl.fyi/c/depot/+/10348 Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/builtins')
-rw-r--r-- | tvix/eval/src/builtins/mod.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs index 7cc2732ecfd9..6ecbb5028471 100644 --- a/tvix/eval/src/builtins/mod.rs +++ b/tvix/eval/src/builtins/mod.rs @@ -312,8 +312,11 @@ mod pure_builtins { #[builtin("elem")] async fn builtin_elem(co: GenCo, x: Value, xs: Value) -> Result<Value, ErrorKind> { for val in xs.to_list()? { - if generators::check_equality(&co, x.clone(), val, PointerEquality::AllowAll).await? { - return Ok(true.into()); + match generators::check_equality(&co, x.clone(), val, PointerEquality::AllowAll).await? + { + Ok(true) => return Ok(true.into()), + Ok(false) => continue, + Err(cek) => return Ok(Value::Catchable(cek)), } } Ok(false.into()) @@ -1183,7 +1186,7 @@ mod pure_builtins { /// value has been seen before. async fn bgc_insert_key(co: &GenCo, key: Value, done: &mut Vec<Value>) -> Result<bool, ErrorKind> { for existing in done.iter() { - if generators::check_equality( + match generators::check_equality( co, existing.clone(), key.clone(), @@ -1192,7 +1195,11 @@ async fn bgc_insert_key(co: &GenCo, key: Value, done: &mut Vec<Value>) -> Result ) .await? { - return Ok(false); + Ok(true) => return Ok(false), + Ok(false) => (), + Err(_cek) => { + unimplemented!("TODO(amjoseph): not sure what the correct behavior is here") + } } } |