From 994bf03b74672d3a8602e7dc1b73de1fd97830a3 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 20 Nov 2022 23:31:08 +0100 Subject: fix(tvix/eval): ensure callable is forced when using call_with When passing multiple arguments, every intermediate callable needs to be forced as this is expected by the VM's call_value function. Also adds a debug assertion for this which makes it easier to spot exactly what went wrong. Change-Id: I3aa519cb6cdaab713bd18282bef901c4cd77c535 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7312 Tested-by: BuildkiteCI Reviewed-by: sterni --- tvix/eval/src/value/thunk.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tvix/eval/src/value/thunk.rs') diff --git a/tvix/eval/src/value/thunk.rs b/tvix/eval/src/value/thunk.rs index 549534b04e..5eee07a9e7 100644 --- a/tvix/eval/src/value/thunk.rs +++ b/tvix/eval/src/value/thunk.rs @@ -133,6 +133,10 @@ impl Thunk { } } + pub fn is_evaluated(&self) -> bool { + matches!(*self.0.borrow(), ThunkRepr::Evaluated(_)) + } + /// Returns a reference to the inner evaluated value of a thunk. /// It is an error to call this on a thunk that has not been /// forced, or is not otherwise known to be fully evaluated. -- cgit 1.4.1