Only use pending specializations for other modules

This commit is contained in:
Richard Feldman 2020-07-12 22:43:34 -04:00
parent 0b6053e2f6
commit c2bc98ea4b
4 changed files with 69 additions and 28 deletions

View file

@ -230,11 +230,12 @@ pub fn build(
let mut headers = Vec::with_capacity(procs.pending_specializations.len());
let mut layout_cache = LayoutCache::default();
let mut procs = roc_mono::expr::specialize_all(&mut mono_env, procs, &mut layout_cache);
let (mut specializations, runtime_errors) =
roc_mono::expr::specialize_all(&mut mono_env, procs, &mut layout_cache);
assert_eq!(runtime_errors, roc_collections::all::MutSet::default());
assert_eq!(
procs.runtime_errors,
roc_collections::all::MutSet::default()
);
// Put this module's ident_ids back in the interns, so we can use them in env.
// This must happen *after* building the headers, because otherwise there's
@ -244,7 +245,7 @@ pub fn build(
// Add all the Proc headers to the module.
// We have to do this in a separate pass first,
// because their bodies may reference each other.
for ((symbol, layout), proc) in specializations.drain() {
for ((symbol, layout), proc) in procs.specialized.drain() {
let (fn_val, arg_basic_types) =
build_proc_header(&env, &mut layout_ids, symbol, &layout, &proc);