diff options
-rw-r--r-- | kernel/mod_subst.ml | 8 | ||||
-rw-r--r-- | kernel/mod_subst.mli | 2 | ||||
-rw-r--r-- | library/declaremods.ml | 1 |
3 files changed, 11 insertions, 0 deletions
diff --git a/kernel/mod_subst.ml b/kernel/mod_subst.ml index 3b3d28090..0df3e6631 100644 --- a/kernel/mod_subst.ml +++ b/kernel/mod_subst.ml @@ -404,6 +404,14 @@ let join_alias (subst1 : substitution) (subst2 : substitution) = mp',resolve'' in Umap.mapi (apply_subst subst2) subst1 +let remove_alias subst = + let rec remove key (mp,resolve) sub = + match key with + MPI _ -> sub + | _ -> Umap.add key (mp,resolve) sub + in + Umap.fold remove subst empty_subst + let rec occur_in_path uid path = match uid,path with diff --git a/kernel/mod_subst.mli b/kernel/mod_subst.mli index b54ae6f3b..5384d0f85 100644 --- a/kernel/mod_subst.mli +++ b/kernel/mod_subst.mli @@ -88,3 +88,5 @@ val update_subst_alias : substitution -> substitution -> substitution val subst_key : substitution -> substitution -> substitution val join_alias : substitution -> substitution -> substitution + +val remove_alias : substitution -> substitution diff --git a/library/declaremods.ml b/library/declaremods.ml index 80944b2e6..7c228741b 100644 --- a/library/declaremods.ml +++ b/library/declaremods.ml @@ -770,6 +770,7 @@ let classify_import (_,(export,_ as obj)) = if export then Substitute obj else Dispose let subst_import (_,subst,(export,mp as obj)) = + let subst = remove_alias subst in let mp' = subst_mp subst mp in if mp'==mp then obj else (export,mp') |