remove unused value constructors from modules type info
This is a mildly scaring change, as it may horribly break things down the line if we have ever relied on that information... However, the value constructors inside each module are meant to reflect the own module public API, and shouldn't be populated with Prelude stuff. Not only does that mean this information is duplicated for all modules (possibly significantly slowing things down), but it may also cause weird scoping issues (e.g. one accessing a Prelude's constructor through some random module). Hence why I am isolating this change in this single commit, so it's easier to troubleshoot if that ends up causing weird issues. Signed-off-by: KtorZ <matthias.benkort@gmail.com>
This commit is contained in:
parent
79a7d80c7f
commit
c66bca5829
|
@ -17,7 +17,12 @@ use crate::{
|
|||
tipo::{expr::infer_function, Span, Type, TypeVar},
|
||||
IdGenerator,
|
||||
};
|
||||
use std::{borrow::Borrow, collections::HashMap, ops::Deref, rc::Rc};
|
||||
use std::{
|
||||
borrow::Borrow,
|
||||
collections::{BTreeSet, HashMap},
|
||||
ops::Deref,
|
||||
rc::Rc,
|
||||
};
|
||||
|
||||
impl UntypedModule {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
|
@ -116,8 +121,14 @@ impl UntypedModule {
|
|||
.module_types
|
||||
.retain(|_, info| info.public && info.module == module_name);
|
||||
|
||||
let own_types = environment.module_types.keys().collect::<BTreeSet<_>>();
|
||||
|
||||
environment.module_values.retain(|_, info| info.public);
|
||||
|
||||
environment
|
||||
.module_types_constructors
|
||||
.retain(|k, _| own_types.contains(k));
|
||||
|
||||
environment
|
||||
.accessors
|
||||
.retain(|_, accessors| accessors.public);
|
||||
|
|
Loading…
Reference in New Issue