refactor(tvix/eval): Make strict an EvalMode enum

Refactor the `strict` boolean passed into evaluation at the top-level to
be a (two-variant, so far) EvalMode enum of Lazy and Strict.

This is more explicit than a boolean, and if we ever add more EvalModes
it's a simple extension of the enum.

Change-Id: I3de50e74ec971011664f6cd0999d08b792118410
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12186
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: aspen <root@gws.fyi>
This commit is contained in:
Aspen Smith 2024-08-11 11:15:47 -04:00 committed by clbot
parent 934e03c0de
commit b7a6fc2812
8 changed files with 50 additions and 31 deletions

View file

@ -4,7 +4,7 @@ use clap::Parser;
use pretty_assertions::assert_eq;
use std::path::PathBuf;
use tvix_build::buildservice::DummyBuildService;
use tvix_eval::{EvalIO, Value};
use tvix_eval::{EvalIO, EvalMode, Value};
use tvix_store::utils::{construct_services, ServiceUrlsMemory};
use rstest::rstest;
@ -54,7 +54,7 @@ fn eval_test(code_path: PathBuf, expect_success: bool) {
tvix_store_io.clone() as Rc<dyn EvalIO>,
)) as Box<dyn EvalIO>)
.enable_import()
.strict();
.mode(EvalMode::Strict);
eval_builder = add_derivation_builtins(eval_builder, Rc::clone(&tvix_store_io));
eval_builder = add_fetcher_builtins(eval_builder, Rc::clone(&tvix_store_io));