Initial support for erasure in tests

This commit is contained in:
Ayaz Hafiz 2023-06-22 20:57:24 -05:00
parent 15ae7489a8
commit 6014370b91
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
5 changed files with 52 additions and 6 deletions

View file

@ -11,7 +11,7 @@ use roc_can::{
};
use roc_derive::SharedDerivedModule;
use roc_late_solve::AbilitiesView;
use roc_load::LoadedModule;
use roc_load::{FunctionKind, LoadedModule};
use roc_module::symbol::{Interns, ModuleId};
use roc_packaging::cache::RocCacheDir;
use roc_problem::can::Problem;
@ -48,6 +48,7 @@ pub fn run_load_and_infer<'a>(
src: &str,
dependencies: impl IntoIterator<Item = (&'a str, &'a str)>,
no_promote: bool,
function_kind: FunctionKind,
) -> Result<(LoadedModule, String), std::io::Error> {
use tempfile::tempdir;
@ -79,8 +80,7 @@ pub fn run_load_and_infer<'a>(
module_src,
dir.path().to_path_buf(),
roc_target::TargetInfo::default_x86_64(),
// TODO parameterize me!
roc_solve::FunctionKind::LambdaSet,
function_kind,
roc_reporting::report::RenderTarget::Generic,
RocCacheDir::Disallowed,
roc_reporting::report::DEFAULT_PALETTE,
@ -353,6 +353,7 @@ pub fn infer_queries<'a>(
dependencies: impl IntoIterator<Item = (&'a str, &'a str)>,
options: InferOptions,
allow_can_errors: bool,
function_kind: FunctionKind,
) -> Result<InferredProgram, Box<dyn Error>> {
let (
LoadedModule {
@ -366,7 +367,7 @@ pub fn infer_queries<'a>(
..
},
src,
) = run_load_and_infer(src, dependencies, options.no_promote)?;
) = run_load_and_infer(src, dependencies, options.no_promote, function_kind)?;
let declarations = declarations_by_id.remove(&home).unwrap();
let subs = solved.inner_mut();