about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tvix/eval/src/tests/tvix_tests/eval-okay-lazy-equality.exp2
-rw-r--r--tvix/eval/src/tests/tvix_tests/eval-okay-lazy-equality.nix4
-rw-r--r--tvix/eval/src/value/mod.rs10
3 files changed, 13 insertions, 3 deletions
diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-lazy-equality.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-lazy-equality.exp
index e6f2d1aaad..1c70d1bcf1 100644
--- a/tvix/eval/src/tests/tvix_tests/eval-okay-lazy-equality.exp
+++ b/tvix/eval/src/tests/tvix_tests/eval-okay-lazy-equality.exp
@@ -1 +1 @@
-[ true true false ]
+[ true true false true true ]
diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-lazy-equality.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-lazy-equality.nix
index b0ec8593a4..d19d1213d6 100644
--- a/tvix/eval/src/tests/tvix_tests/eval-okay-lazy-equality.nix
+++ b/tvix/eval/src/tests/tvix_tests/eval-okay-lazy-equality.nix
@@ -4,8 +4,12 @@ let
   list1 = [ (1 + 2) ];
   list2 = [ (2 + 1) ];
   list3 = [ (2 + 2) ];
+  list4 = [ (2 + 2) ];
+  list5 = [ (2 + 2) ];
 in [
   (attrs1 == attrs2)
   (list1 == list2)
   (list3 == list2)
+  (list4 == [ 4 ])
+  ([ 4 ] == list5)
 ]
diff --git a/tvix/eval/src/value/mod.rs b/tvix/eval/src/value/mod.rs
index de59691f27..e6a6052c21 100644
--- a/tvix/eval/src/value/mod.rs
+++ b/tvix/eval/src/value/mod.rs
@@ -288,8 +288,14 @@ impl Value {
 
                 Ok(*lhs.value() == *rhs.value())
             }
-            (Value::Thunk(lhs), rhs) => Ok(&*lhs.value() == rhs),
-            (lhs, Value::Thunk(rhs)) => Ok(lhs == &*rhs.value()),
+            (Value::Thunk(lhs), rhs) => {
+                lhs.force(vm)?;
+                Ok(&*lhs.value() == rhs)
+            }
+            (lhs, Value::Thunk(rhs)) => {
+                rhs.force(vm)?;
+                Ok(lhs == &*rhs.value())
+            }
 
             // Everything else is either incomparable (e.g. internal
             // types) or false.