mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
Distinguish between pending and resolved ability stores
Now that we have unspecialized lambda sets, we need to properly copy their specialization variables when a module imports another modules' ability store. I think it will be easier to ensure the correctness if we distinguish between a "pending" ability store (which may contain imports whose variables have not been added to subs yet) and "resolved" abilities stores, which are what we care about for solve and later on. There is a cost to this since `PendingAbilitiesStore#resolve` destroys and collects all of the ability member data, rather than in-place mutating as we did before. However, the resulting `AbilitiesStore` is now much smaller, so the memory footprint will be better, and also every field besides `ability_members` will be moved rather than copied.
This commit is contained in:
parent
a57dd820a1
commit
aa9b70a7c8
8 changed files with 228 additions and 139 deletions
|
@ -1,4 +1,4 @@
|
|||
use crate::abilities::AbilitiesStore;
|
||||
use crate::abilities::PendingAbilitiesStore;
|
||||
use crate::annotation::canonicalize_annotation;
|
||||
use crate::def::{canonicalize_toplevel_defs, sort_can_defs, Declaration, Def};
|
||||
use crate::effect_module::HostedGeneratedFunctions;
|
||||
|
@ -30,7 +30,7 @@ pub struct Module {
|
|||
/// all aliases. `bool` indicates whether it is exposed
|
||||
pub aliases: MutMap<Symbol, (bool, Alias)>,
|
||||
pub rigid_variables: RigidVariables,
|
||||
pub abilities_store: AbilitiesStore,
|
||||
pub abilities_store: PendingAbilitiesStore,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
|
@ -167,7 +167,7 @@ pub fn canonicalize_module_defs<'a>(
|
|||
exposed_ident_ids: IdentIds,
|
||||
dep_idents: &'a IdentIdsByModule,
|
||||
aliases: MutMap<Symbol, Alias>,
|
||||
imported_abilities_state: AbilitiesStore,
|
||||
imported_abilities_state: PendingAbilitiesStore,
|
||||
exposed_imports: MutMap<Ident, (Symbol, Region)>,
|
||||
exposed_symbols: &VecSet<Symbol>,
|
||||
symbols_from_requires: &[(Loc<Symbol>, Loc<TypeAnnotation<'a>>)],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue