feat(tvix/eval): add Evaluation::strict to toggle top-level deepseq
This makes it possible for callers to control whether they can receive partially evaluated values from an evaluation or not. We're actually flipping the default behaviour to non-strict top-level evaluation, which means that callers have to set `strict = true` on the Evaluation to get the previous behaviour. Change-Id: Ic048e9ba09c88866d4c3177d5fa07db11c4eb20e Reviewed-on: https://cl.tvl.fyi/c/depot/+/8325 Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
parent
a5f28eea94
commit
ba138712e4
5 changed files with 26 additions and 5 deletions
|
|
@ -52,6 +52,7 @@ fn eval_test(code_path: &str, expect_success: bool) {
|
|||
}
|
||||
|
||||
let mut eval = crate::Evaluation::new_impure(&code, Some(code_path.into()));
|
||||
eval.strict = true;
|
||||
eval.builtins.extend(mock_builtins::builtins());
|
||||
|
||||
let result = eval.evaluate();
|
||||
|
|
@ -100,6 +101,7 @@ fn identity(code_path: &str) {
|
|||
let code = std::fs::read_to_string(code_path).expect("should be able to read test code");
|
||||
|
||||
let mut eval = crate::Evaluation::new(&code, None);
|
||||
eval.strict = true;
|
||||
eval.io_handle = Box::new(crate::StdIO);
|
||||
|
||||
let result = eval.evaluate();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue