From 7e625afc5973b3d3ff08598fb9e513aaf1412e89 Mon Sep 17 00:00:00 2001 From: sterni Date: Mon, 12 Sep 2022 17:39:50 +0200 Subject: fix(tvix/eval): force value in builtins.typeOf This prevents Nix programs to observe the "internal" type of thunks. Possibly .type_of() is also an area of the runtime where we should panic if "internal" would ever be returned. Change-Id: I9f358044c48ad64896fb6a1b1a42f00a29efac00 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6539 Autosubmit: sterni Reviewed-by: wpcarro Reviewed-by: grfn Reviewed-by: tazjin Tested-by: BuildkiteCI --- tvix/eval/src/builtins/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tvix/eval/src/builtins/mod.rs') diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs index f08c179045..0fadb738d5 100644 --- a/tvix/eval/src/builtins/mod.rs +++ b/tvix/eval/src/builtins/mod.rs @@ -125,8 +125,10 @@ fn pure_builtins() -> Vec { Ok(Value::String(format!("{}", value).into())) }) }), - Builtin::new("typeOf", 1, |args, _| { - Ok(Value::String(args[0].type_of().into())) + Builtin::new("typeOf", 1, |args, vm| { + force!(vm, &args[0], value, { + Ok(Value::String(value.type_of().into())) + }) }), ] } -- cgit 1.4.1