Fix tests

This commit is contained in:
Richard Feldman 2022-07-08 18:14:26 -04:00
parent 281f2d6842
commit f45e3dbb46
No known key found for this signature in database
GPG key ID: 7E4127D1E4241798
9 changed files with 27 additions and 40 deletions

View file

@ -89,15 +89,15 @@ pub fn load_and_monomorphize_from_str<'a>(
}
}
pub fn load_and_monomorphize<'a>(
arena: &'a Bump,
pub fn load_and_monomorphize(
arena: &Bump,
filename: PathBuf,
src_dir: PathBuf,
exposed_types: ExposedByModule,
target_info: TargetInfo,
render: RenderTarget,
threading: Threading,
) -> Result<MonomorphizedModule<'a>, LoadingProblem<'a>> {
) -> Result<MonomorphizedModule<'_>, LoadingProblem<'_>> {
use LoadResult::*;
let load_start = LoadStart::from_path(arena, src_dir, filename, render)?;
@ -116,15 +116,15 @@ pub fn load_and_monomorphize<'a>(
}
}
pub fn load_and_typecheck<'a>(
arena: &'a Bump,
pub fn load_and_typecheck(
arena: &Bump,
filename: PathBuf,
src_dir: PathBuf,
exposed_types: ExposedByModule,
target_info: TargetInfo,
render: RenderTarget,
threading: Threading,
) -> Result<LoadedModule, LoadingProblem<'a>> {
) -> Result<LoadedModule, LoadingProblem<'_>> {
use LoadResult::*;
let load_start = LoadStart::from_path(arena, src_dir, filename, render)?;

View file

@ -30,23 +30,22 @@ use roc_target::TargetInfo;
use roc_types::pretty_print::name_and_print_var;
use roc_types::pretty_print::DebugPrint;
use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::path::PathBuf;
fn load_and_typecheck<'a>(
arena: &'a Bump,
fn load_and_typecheck(
arena: &Bump,
filename: PathBuf,
src_dir: &Path,
src_dir: PathBuf,
exposed_types: ExposedByModule,
target_info: TargetInfo,
) -> Result<LoadedModule, LoadingProblem<'a>> {
) -> Result<LoadedModule, LoadingProblem> {
use LoadResult::*;
let load_start = LoadStart::from_path(arena, filename, RenderTarget::Generic)?;
let load_start = LoadStart::from_path(arena, src_dir, filename, RenderTarget::Generic)?;
match roc_load_internal::file::load(
arena,
load_start,
src_dir,
exposed_types,
Phase::SolveTypes,
target_info,
@ -167,7 +166,7 @@ fn multiple_modules_help<'a>(
load_and_typecheck(
arena,
full_file_path,
dir.path(),
dir.path().to_path_buf(),
Default::default(),
TARGET_INFO,
)
@ -184,13 +183,7 @@ fn load_fixture(
let src_dir = fixtures_dir().join(dir_name);
let filename = src_dir.join(format!("{}.roc", module_name));
let arena = Bump::new();
let loaded = load_and_typecheck(
&arena,
filename,
src_dir.as_path(),
subs_by_module,
TARGET_INFO,
);
let loaded = load_and_typecheck(&arena, filename, src_dir, subs_by_module, TARGET_INFO);
let mut loaded_module = match loaded {
Ok(x) => x,
Err(roc_load_internal::file::LoadingProblem::FormattedReport(report)) => {
@ -346,13 +339,7 @@ fn interface_with_deps() {
let src_dir = fixtures_dir().join("interface_with_deps");
let filename = src_dir.join("Primary.roc");
let arena = Bump::new();
let loaded = load_and_typecheck(
&arena,
filename,
src_dir.as_path(),
subs_by_module,
TARGET_INFO,
);
let loaded = load_and_typecheck(&arena, filename, src_dir, subs_by_module, TARGET_INFO);
let mut loaded_module = loaded.expect("Test module failed to load");
let home = loaded_module.module_id;

View file

@ -98,7 +98,7 @@ mod solve_expr {
arena,
file_path,
module_src,
dir.path(),
dir.path().to_path_buf(),
exposed_types,
roc_target::TargetInfo::default_x86_64(),
roc_reporting::report::RenderTarget::Generic,
@ -6572,7 +6572,7 @@ mod solve_expr {
A := {}
id1 = \@A {} -> @A {}
#^^^{-1}
id2 = \@A {} -> id1 (@A {})
#^^^{-1} ^^^
@ -6919,7 +6919,7 @@ mod solve_expr {
Ok u -> [Pair u (List.drop inp 1)]
_ -> []
main = any
main = any
"#
),
"Parser U8",

View file

@ -234,7 +234,7 @@ where
&arena,
encode_path().file_name().unwrap().into(),
source,
encode_path().parent().unwrap(),
encode_path().parent().unwrap().to_path_buf(),
Default::default(),
target_info,
roc_reporting::report::RenderTarget::ColorTerminal,

View file

@ -34,12 +34,12 @@ fn create_llvm_module<'a>(
target: &Triple,
opt_level: OptLevel,
) -> (&'static str, String, &'a Module<'a>) {
use std::path::{Path, PathBuf};
use std::path::PathBuf;
let target_info = roc_target::TargetInfo::from(target);
let filename = PathBuf::from("Test.roc");
let src_dir = Path::new("fake/test/path");
let src_dir = PathBuf::from("fake/test/path");
let module_src;
let temp;

View file

@ -73,12 +73,12 @@ fn promote_expr_to_module(src: &str) -> String {
fn compiles_to_ir(test_name: &str, src: &str) {
use bumpalo::Bump;
use std::path::{Path, PathBuf};
use std::path::PathBuf;
let arena = &Bump::new();
let filename = PathBuf::from("Test.roc");
let src_dir = Path::new("fake/test/path");
let src_dir = PathBuf::from("fake/test/path");
let module_src;
let temp;