diff options
author | Vincent Ambo <mail@tazj.in> | 2022-09-02T20·46+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-09-08T12·53+0000 |
commit | b83723a1edef90e4020b9b9af6c905d2badbedea (patch) | |
tree | 50150f08d0a18d85cfc7b21ab63d16f171469e39 | |
parent | 0c0ae50f024d48e9cc482dff164e5ba6bad4189d (diff) |
fix(tvix/eval): force argument of builtins.length r/4750
Change-Id: Iaf94dfc7cb058f5c1c311066d92e01512e09cf71 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6417 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
-rw-r--r-- | tvix/eval/src/builtins/mod.rs | 5 |
1 files changed, 4 insertions, 1 deletions
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<Builtin> { 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, _| { |