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 <sternenseemann@systemli.org> Reviewed-by: wpcarro <wpcarro@gmail.com> Reviewed-by: grfn <grfn@gws.fyi> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
This commit is contained in:
parent
6d53fb6c52
commit
7e625afc59
3 changed files with 27 additions and 2 deletions
|
|
@ -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()))
|
||||
})
|
||||
}),
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue