Push layout interner further through Layout

This commit is contained in:
Ayaz Hafiz 2022-08-31 14:14:34 -05:00
parent ed04c2040a
commit 3b4b1838b8
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
34 changed files with 1279 additions and 634 deletions

View file

@ -22,6 +22,7 @@ use roc_load::Threading;
use roc_module::symbol::Symbol;
use roc_mono::ir::Proc;
use roc_mono::ir::ProcLayout;
use roc_mono::layout::STLayoutInterner;
const TARGET_INFO: roc_target::TargetInfo = roc_target::TargetInfo::default_x86_64();
@ -122,6 +123,7 @@ fn compiles_to_ir(test_name: &str, src: &str) {
module_id: home,
procedures,
exposed_to_host,
layout_interner,
..
} = loaded;
@ -138,13 +140,14 @@ fn compiles_to_ir(test_name: &str, src: &str) {
let main_fn_symbol = exposed_to_host.values.keys().copied().next().unwrap();
verify_procedures(test_name, procedures, main_fn_symbol);
verify_procedures(test_name, layout_interner, procedures, main_fn_symbol);
}
#[cfg(debug_assertions)]
fn verify_procedures(
fn verify_procedures<'a>(
test_name: &str,
procedures: MutMap<(Symbol, ProcLayout<'_>), Proc<'_>>,
interner: STLayoutInterner<'a>,
procedures: MutMap<(Symbol, ProcLayout<'a>), Proc<'a>>,
main_fn_symbol: Symbol,
) {
let index = procedures
@ -154,7 +157,7 @@ fn verify_procedures(
let mut procs_string = procedures
.values()
.map(|proc| proc.to_pretty(200))
.map(|proc| proc.to_pretty(&interner, 200))
.collect::<Vec<_>>();
let main_fn = procs_string.swap_remove(index);
@ -169,6 +172,7 @@ fn verify_procedures(
std::fs::write(&path, result).unwrap();
use std::process::Command;
let is_tracked = Command::new("git")
.args(&["ls-files", "--error-unmatch", &path])
.output()