summaryrefslogtreecommitdiff
path: root/typing/env.ml
diff options
context:
space:
mode:
Diffstat (limited to 'typing/env.ml')
-rw-r--r--typing/env.ml18
1 files changed, 16 insertions, 2 deletions
diff --git a/typing/env.ml b/typing/env.ml
index e7d15ca13b..9e7791168c 100644
--- a/typing/env.ml
+++ b/typing/env.ml
@@ -329,7 +329,7 @@ let read_pers_struct modname filename =
ps_flags = flags } in
if ps.ps_name <> modname then
error (Illegal_renaming(modname, ps.ps_name, filename));
- (*check_consistency filename ps.ps_crcs;*)
+ if not !Clflags.transparent_modules then check_consistency ps;
List.iter
(function Rectypes ->
if not !Clflags.recursive_types then
@@ -486,6 +486,14 @@ let find_module path env =
raise Not_found
end
+let required_globals = ref []
+let reset_required_globals () = required_globals := []
+let get_required_globals () = !required_globals
+let add_required_global id =
+ if Ident.global id && not !Clflags.transparent_modules
+ && not (List.exists (Ident.same id) !required_globals)
+ then required_globals := id :: !required_globals
+
let rec normalize_path lax env path =
let path =
match path with
@@ -496,7 +504,13 @@ let rec normalize_path lax env path =
| _ -> path
in
try match find_module path env with
- {md_type=Mty_alias path} -> normalize_path lax env path
+ {md_type=Mty_alias path1} ->
+ let path' = normalize_path lax env path1 in
+ if lax || !Clflags.transparent_modules then path' else
+ let id = Path.head path in
+ if Ident.global id && not (Ident.same id (Path.head path'))
+ then add_required_global id;
+ path'
| _ -> path
with Not_found when lax
|| (match path with Pident id -> not (Ident.persistent id) | _ -> true) ->