about summary refs log tree commit diff
path: root/tvix/eval/src/builtins/mod.rs
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2022-09-12T15·39+0200
committerclbot <clbot@tvl.fyi>2022-09-13T22·06+0000
commit7e625afc5973b3d3ff08598fb9e513aaf1412e89 (patch)
tree79fae5f8834fb798326bf31553bc675c90ac14c7 /tvix/eval/src/builtins/mod.rs
parent6d53fb6c522ae21a5b930920b72a66f551f82c65 (diff)
fix(tvix/eval): force value in builtins.typeOf r/4848
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 <sternenseemann@systemli.org>
Reviewed-by: wpcarro <wpcarro@gmail.com>
Reviewed-by: grfn <grfn@gws.fyi>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/builtins/mod.rs')
-rw-r--r--tvix/eval/src/builtins/mod.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs
index f08c17904584..0fadb738d529 100644
--- a/tvix/eval/src/builtins/mod.rs
+++ b/tvix/eval/src/builtins/mod.rs
@@ -125,8 +125,10 @@ fn pure_builtins() -> Vec<Builtin> {
                 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()))
+            })
         }),
     ]
 }