Thread simple model of "ErasedLambdas" through proc layouts

But none of these paths are yet exercised.
This commit is contained in:
Ayaz Hafiz 2023-06-23 13:15:12 -05:00
parent 6eae480e36
commit c459757062
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
8 changed files with 79 additions and 11 deletions

View file

@ -8,20 +8,22 @@ use roc_mono::{
ir::{Proc, ProcLayout},
layout::STLayoutInterner,
};
use roc_solve::FunctionKind;
use tempfile::tempdir;
use test_solve_helpers::format_problems;
use crate::CompilerSettings;
#[derive(Default)]
pub struct MonoOptions {
pub(crate) struct MonoOptions {
pub no_check: bool,
}
pub fn write_compiled_ir<'a>(
pub(crate) fn write_compiled_ir<'a>(
writer: &mut impl io::Write,
test_module: &str,
dependencies: impl IntoIterator<Item = (&'a str, &'a str)>,
options: MonoOptions,
compiler_settings: CompilerSettings,
allow_can_errors: bool,
) -> io::Result<()> {
use roc_packaging::cache::RocCacheDir;
@ -42,8 +44,7 @@ pub fn write_compiled_ir<'a>(
let load_config = LoadConfig {
target_info: roc_target::TargetInfo::default_x86_64(),
// TODO parameterize
function_kind: FunctionKind::LambdaSet,
function_kind: compiler_settings.function_kind,
threading: Threading::Single,
render: roc_reporting::report::RenderTarget::Generic,
palette: roc_reporting::report::DEFAULT_PALETTE,

View file

@ -128,6 +128,7 @@ fn run_test(path: PathBuf) -> Result<(), Failed> {
&mut fd,
program,
inferred_program,
compiler_settings,
can_options,
mono_options,
emit_options,
@ -363,6 +364,7 @@ fn assemble_query_output(
writer: &mut impl io::Write,
program: Modules<'_>,
inferred_program: InferredProgram,
compiler_settings: CompilerSettings,
can_options: CanOptions,
mono_options: MonoOptions,
emit_options: EmitOptions,
@ -411,6 +413,7 @@ fn assemble_query_output(
test_module,
other_modules,
mono_options,
compiler_settings,
can_options.allow_errors,
)?;
}

View file

@ -1,5 +1,6 @@
# +set function_kind=erased
interface Test exposes [main] imports []
# +emit:mono
app "test" provides [main] to "./platform"
f = \s ->
if Bool.true
@ -8,5 +9,7 @@ f = \s ->
else \{} -> s
# ^^^^^^^^ {}* -[[#Attr.#Erased(33)]]-> Str
main = f ""
#^^^^{-1} {}w_a -[[#Attr.#Erased(33)]]-> Str
main = (f "") {}
# ^^^^ {} -[[#Attr.#Erased(33)]]-> Str
# -emit:mono