diff --git a/Cargo.lock b/Cargo.lock index 26ae33dfde..d6be2fd7ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2914,6 +2914,7 @@ dependencies = [ "inlinable_string", "libloading 0.6.7", "maplit", + "morphic_lib", "pretty_assertions 0.5.1", "quickcheck 0.8.5", "quickcheck_macros 0.8.0", diff --git a/compiler/build/Cargo.toml b/compiler/build/Cargo.toml index a7f173d2e2..5b0bdd4392 100644 --- a/compiler/build/Cargo.toml +++ b/compiler/build/Cargo.toml @@ -21,6 +21,7 @@ roc_mono = { path = "../mono" } roc_load = { path = "../load" } roc_gen = { path = "../gen" } roc_reporting = { path = "../reporting" } +morphic_lib = { path = "../../vendor/morphic_lib" } im = "14" # im and im-rc should always have the same version! im-rc = "14" # im and im-rc should always have the same version! bumpalo = { version = "3.6.1", features = ["collections"] } diff --git a/compiler/build/src/program.rs b/compiler/build/src/program.rs index 3fad005f6e..f8d1e5af82 100644 --- a/compiler/build/src/program.rs +++ b/compiler/build/src/program.rs @@ -157,8 +157,27 @@ pub fn gen_from_mono_module( headers.push((proc, fn_val)); } + use roc_load::file::AliasAnalysisSolutions::*; + let solutions = match loaded.alias_analysis_solutions { + NotAvailable => panic!(), + Available(solutions) => solutions, + }; + + let module_solutions = solutions + .mod_solutions(roc_mono::alias_analysis::MOD_APP) + .unwrap(); + // Build each proc using its header info. for (proc, fn_val) in headers { + let bytes = proc.name.to_ne_bytes(); + let func_name = morphic_lib::FuncName(&bytes); + let func_specs = module_solutions.func_solutions(func_name).unwrap(); + + for spec_name in func_specs.specs() { + let morphic_lib::FuncSpec(bytes) = spec_name; + dbg!(proc.name, unsafe { std::str::from_utf8_unchecked(bytes) },); + let spec = func_specs.spec(spec_name).unwrap(); + } // NOTE: This is here to be uncommented in case verification fails. // (This approach means we don't have to defensively clone name here.) // diff --git a/compiler/load/src/file.rs b/compiler/load/src/file.rs index cf9ff87acc..687b9c364d 100644 --- a/compiler/load/src/file.rs +++ b/compiler/load/src/file.rs @@ -2085,7 +2085,7 @@ fn update<'a>( &mut state.procedures, ); - if false { + if true { let it = state.procedures.iter().map(|x| x.1); match roc_mono::alias_analysis::spec_program(it) {