mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 23:31:12 +00:00
Save ability specializations
Unfortunately not enough...
This commit is contained in:
parent
f8cf18b10e
commit
3f4336d15a
2 changed files with 55 additions and 18 deletions
|
@ -136,6 +136,7 @@ struct ModuleCache<'a> {
|
|||
/// Various information
|
||||
imports: MutMap<ModuleId, MutSet<ModuleId>>,
|
||||
top_level_thunks: MutMap<ModuleId, MutSet<Symbol>>,
|
||||
ability_specializations: MutMap<ModuleId, VecMap<Symbol, PartialProc<'a>>>,
|
||||
documentation: MutMap<ModuleId, ModuleDocumentation>,
|
||||
can_problems: MutMap<ModuleId, Vec<roc_problem::can::Problem>>,
|
||||
type_problems: MutMap<ModuleId, Vec<solve::TypeError>>,
|
||||
|
@ -181,6 +182,7 @@ impl Default for ModuleCache<'_> {
|
|||
external_specializations_requested: Default::default(),
|
||||
imports: Default::default(),
|
||||
top_level_thunks: Default::default(),
|
||||
ability_specializations: Default::default(),
|
||||
documentation: Default::default(),
|
||||
can_problems: Default::default(),
|
||||
type_problems: Default::default(),
|
||||
|
@ -437,7 +439,7 @@ fn start_phase<'a>(
|
|||
module_id,
|
||||
ident_ids,
|
||||
subs,
|
||||
procs_base,
|
||||
mut procs_base,
|
||||
layout_cache,
|
||||
module_timing,
|
||||
mut abilities_store,
|
||||
|
@ -463,6 +465,13 @@ fn start_phase<'a>(
|
|||
}
|
||||
}
|
||||
}
|
||||
for (_, ability_specializations) in
|
||||
state.module_cache.ability_specializations.iter()
|
||||
{
|
||||
procs_base
|
||||
.partial_procs
|
||||
.extend(ability_specializations.iter().map(|(s, p)| (*s, p.clone())));
|
||||
}
|
||||
|
||||
BuildTask::MakeSpecializations {
|
||||
module_id,
|
||||
|
@ -2208,6 +2217,30 @@ fn update<'a>(
|
|||
.or_default()
|
||||
.extend(procs_base.module_thunks.iter().copied());
|
||||
|
||||
let ability_specialization_procs: VecMap<_, _> = state
|
||||
.exposed_types
|
||||
.get(&module_id)
|
||||
.expect("Module solved, but no exposed types")
|
||||
.solved_specializations
|
||||
.iter()
|
||||
.map(|(_, specialization)| {
|
||||
(
|
||||
specialization.symbol,
|
||||
procs_base
|
||||
.partial_procs
|
||||
.get(&specialization.symbol)
|
||||
.expect("Specialization known, but not exposed")
|
||||
.clone(),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
|
||||
let old = state
|
||||
.module_cache
|
||||
.ability_specializations
|
||||
.insert(module_id, ability_specialization_procs);
|
||||
debug_assert!(old.is_none(), "Found specializations for module twice");
|
||||
|
||||
let found_specializations_module = FoundSpecializationsModule {
|
||||
module_id,
|
||||
ident_ids,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue