diff --git a/cli/src/input.rs b/cli/src/input.rs index 502d275a1f..939e8c9b69 100644 --- a/cli/src/input.rs +++ b/cli/src/input.rs @@ -35,7 +35,6 @@ impl Prepare for InputOptions { fn prepare(&self, global: &GlobalOptions) -> CliResult> { let mut program = match self.files.as_slice() { [] => Program::new_from_stdin(std::io::stderr()), - [p] => Program::new_from_file(p, std::io::stderr()), files => Program::new_from_files(files, std::io::stderr()), }?; diff --git a/core/src/program.rs b/core/src/program.rs index dd185ff846..da8806e895 100644 --- a/core/src/program.rs +++ b/core/src/program.rs @@ -230,24 +230,6 @@ impl Program { }) } - pub fn new_from_file( - path: impl Into, - trace: impl Write + 'static, - ) -> std::io::Result { - increment!("Program::new"); - - let mut cache = Cache::new(ErrorTolerance::Strict); - let main_id = cache.add_file(path)?; - let vm = VirtualMachine::new(cache, trace); - Ok(Self { - main_id, - vm, - color_opt: clap::ColorChoice::Auto.into(), - overrides: Vec::new(), - field: FieldPath::new(), - }) - } - /// Create a program by reading it from a generic source. pub fn new_from_source( source: T, diff --git a/core/tests/examples/main.rs b/core/tests/examples/main.rs index 05e863dda4..b366616a5e 100644 --- a/core/tests/examples/main.rs +++ b/core/tests/examples/main.rs @@ -14,7 +14,7 @@ fn check_example_file(path: &str) { read_annotated_test_case(path).expect("Failed to parse annotated program"); // `test_resources` uses paths relative to the workspace manifesty - let mut p = TestProgram::new_from_file(project_root().join(path), std::io::stderr()) + let mut p = TestProgram::new_from_files(vec![project_root().join(path)], std::io::stderr()) .expect("Failed to load program from file"); match test.annotation { diff --git a/utils/src/test_program.rs b/utils/src/test_program.rs index 60a9287df7..5afbd07d05 100644 --- a/utils/src/test_program.rs +++ b/utils/src/test_program.rs @@ -49,7 +49,11 @@ pub fn typecheck_fixture(f: &str) -> Result<(), Error> { } fn program_from_test_fixture(f: &str) -> Program { - let path = format!("{}/../tests/integration/{}", env!("CARGO_MANIFEST_DIR"), f); - Program::new_from_file(&path, std::io::stderr()) - .unwrap_or_else(|e| panic!("Could not create program from `{}`\n {}", path, e)) + let paths = vec![format!( + "{}/../tests/integration/{}", + env!("CARGO_MANIFEST_DIR"), + f + )]; + Program::new_from_files(&paths, std::io::stderr()) + .unwrap_or_else(|e| panic!("Could not create program from `{}`\n {}", paths[0], e)) }