Handle root type when loading from str

This commit is contained in:
Agus Zubiaga 2024-06-08 19:46:41 -03:00
parent 0283bd1d24
commit 4e5fdfbf52
No known key found for this signature in database
12 changed files with 127 additions and 101 deletions

View file

@ -104,12 +104,14 @@ pub fn load_and_monomorphize_from_str<'a>(
filename: PathBuf,
src: &'a str,
src_dir: PathBuf,
opt_main_path: Option<PathBuf>,
roc_cache_dir: RocCacheDir<'_>,
load_config: LoadConfig,
) -> Result<MonomorphizedModule<'a>, LoadMonomorphizedError<'a>> {
use LoadResult::*;
let load_start = LoadStart::from_str(arena, filename, src, roc_cache_dir, src_dir)?;
let load_start =
LoadStart::from_str(arena, filename, opt_main_path, src, roc_cache_dir, src_dir)?;
let exposed_types = ExposedByModule::default();
match load(arena, load_start, exposed_types, roc_cache_dir, load_config)? {
@ -176,6 +178,7 @@ pub fn load_and_typecheck_str<'a>(
filename: PathBuf,
source: &'a str,
src_dir: PathBuf,
opt_main_path: Option<PathBuf>,
target: Target,
function_kind: FunctionKind,
render: RenderTarget,
@ -184,7 +187,14 @@ pub fn load_and_typecheck_str<'a>(
) -> Result<LoadedModule, LoadingProblem<'a>> {
use LoadResult::*;
let load_start = LoadStart::from_str(arena, filename, source, roc_cache_dir, src_dir)?;
let load_start = LoadStart::from_str(
arena,
filename,
opt_main_path,
source,
roc_cache_dir,
src_dir,
)?;
// NOTE: this function is meant for tests, and so we use single-threaded
// solving so we don't use too many threads per-test. That gives higher