about summary refs log tree commit diff
path: root/tvix/eval/src/value/mod.rs
diff options
context:
space:
mode:
authorRyan Lahfa <tvl@lahfa.xyz>2023-12-30T02·21+0100
committerraitobezarius <tvl@lahfa.xyz>2024-01-14T03·37+0000
commit2750e1e640f5228afe1efcdb4deb4922887d0121 (patch)
tree1dccb67909d8a951ec49f5302ff1b5ad6e9fd11d /tvix/eval/src/value/mod.rs
parent37cc88897e0c6baa9835b49842e723f9e7006f5f (diff)
fix(tvix/eval): catchable-aware builtins r/7379
A bunch of operations in Tvix are not aware of catchable values
and does not propagate them.

In the meantime, as we wait for a better solution, we just offer this
commit for moving the needle.

Change-Id: Ic3f0e1550126b0847b597dfc1402c35e0eeef469
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10473
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tvix/eval/src/value/mod.rs')
-rw-r--r--tvix/eval/src/value/mod.rs23
1 files changed, 13 insertions, 10 deletions
diff --git a/tvix/eval/src/value/mod.rs b/tvix/eval/src/value/mod.rs
index 1558d2cc9c24..ccca0bea5b2e 100644
--- a/tvix/eval/src/value/mod.rs
+++ b/tvix/eval/src/value/mod.rs
@@ -589,16 +589,19 @@ impl Value {
                                         .context("comparing derivations")?
                                         .clone();
 
-                                    let result = out1
-                                        .clone()
-                                        .force(co, span.clone())
-                                        .await?
-                                        .to_contextful_str()?
-                                        == out2
-                                            .clone()
-                                            .force(co, span.clone())
-                                            .await?
-                                            .to_contextful_str()?;
+                                    let out1 = out1.clone().force(co, span.clone()).await?;
+                                    let out2 = out2.clone().force(co, span.clone()).await?;
+
+                                    if out1.is_catchable() {
+                                        return Ok(out1);
+                                    }
+
+                                    if out2.is_catchable() {
+                                        return Ok(out2);
+                                    }
+
+                                    let result =
+                                        out1.to_contextful_str()? == out2.to_contextful_str()?;
                                     if !result {
                                         return Ok(Value::Bool(false));
                                     } else {