about summary refs log tree commit diff
path: root/tvix/eval/src/builtins
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2023-12-09T08·58-0800
committerclbot <clbot@tvl.fyi>2023-12-12T14·26+0000
commitad566999ca81e5d584acb5107e327a1aec9fdd5a (patch)
treed5e1e0d11fda7ef6e297d48e62df8978d20d924d /tvix/eval/src/builtins
parentae28dc3ca64eb09d0ed792f0145576c17920ede5 (diff)
fix(tvix/eval): preserve catchables in nix_cmp_ordering(), fix b/338 r/7169
This commit fixes b/338 by properly propagating catchables through
comparison operations.

Change-Id: I6b0283a40f228ecf9a6398d24c060bdacb1077cf
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10221
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Autosubmit: Adam Joseph <adam@westernsemico.com>
Diffstat (limited to 'tvix/eval/src/builtins')
-rw-r--r--tvix/eval/src/builtins/mod.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs
index 1a34ea5dfbac..09b341886c59 100644
--- a/tvix/eval/src/builtins/mod.rs
+++ b/tvix/eval/src/builtins/mod.rs
@@ -611,10 +611,11 @@ mod pure_builtins {
     #[builtin("lessThan")]
     async fn builtin_less_than(co: GenCo, x: Value, y: Value) -> Result<Value, ErrorKind> {
         let span = generators::request_span(&co).await;
-        Ok(Value::Bool(matches!(
-            x.nix_cmp_ordering(y, co, span).await?,
-            Ordering::Less
-        )))
+        match x.nix_cmp_ordering(y, co, span).await? {
+            Err(cek) => Ok(Value::Catchable(cek)),
+            Ok(Ordering::Less) => Ok(Value::Bool(true)),
+            Ok(_) => Ok(Value::Bool(false)),
+        }
     }
 
     #[builtin("listToAttrs")]