From b83723a1edef90e4020b9b9af6c905d2badbedea Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 2 Sep 2022 23:46:06 +0300 Subject: fix(tvix/eval): force argument of builtins.length Change-Id: Iaf94dfc7cb058f5c1c311066d92e01512e09cf71 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6417 Reviewed-by: sterni Tested-by: BuildkiteCI --- tvix/eval/src/builtins/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tvix') diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs index d0ed834a9e2c..947854e6f00a 100644 --- a/tvix/eval/src/builtins/mod.rs +++ b/tvix/eval/src/builtins/mod.rs @@ -45,7 +45,10 @@ fn pure_builtins() -> Vec { let a = args.pop().unwrap(); arithmetic_op!(a, b, /) }), - Builtin::new("length", 1, |args, _| { + Builtin::new("length", 1, |args, vm| { + if let Value::Thunk(t) = &args[0] { + t.force(vm)?; + } Ok(Value::Integer(args[0].to_list()?.len() as i64)) }), Builtin::new("isAttrs", 1, |args, _| { -- cgit 1.4.1