Skip to content

Commit

Permalink
make sure that local module types always have priority over imported …
Browse files Browse the repository at this point in the history
…ones
  • Loading branch information
ncannasse committed Sep 18, 2012
1 parent c7add2e commit 8e15c06
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions typeload.ml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ let rec load_type_def ctx p t =
List.find (fun t2 ->
let tp = t_path t2 in
tp = (t.tpackage,tname) || (no_pack && snd tp = tname)
) ctx.m.module_types
) (ctx.m.curmod.m_types @ ctx.m.module_types)
with
Not_found ->
let next() =
Expand Down Expand Up @@ -431,7 +431,7 @@ let hide_types ctx =
let old_type_params = ctx.type_params in
ctx.m <- {
curmod = ctx.g.std;
module_types = ctx.g.std.m_types;
module_types = [];
module_using = [];
module_globals = PMap.empty;
wildcard_packages = [];
Expand Down Expand Up @@ -720,7 +720,8 @@ let set_heritance ctx c herits p =
| _ :: _ -> t
| [] ->
try
let lt = List.find (fun lt -> snd (t_path lt) = t.tname) ctx.m.module_types in
let find = List.find (fun lt -> snd (t_path lt) = t.tname) in
let lt = try find ctx.m.curmod.m_types with Not_found -> find ctx.m.module_types in
{ t with tpackage = fst (t_path lt) }
with
Not_found -> t
Expand Down Expand Up @@ -1738,7 +1739,7 @@ let type_module ctx m file tdecls p =
t = ctx.t;
m = {
curmod = m;
module_types = m.m_types @ ctx.g.std.m_types;
module_types = ctx.g.std.m_types;
module_using = [];
module_globals = PMap.empty;
wildcard_packages = [];
Expand Down
4 changes: 2 additions & 2 deletions typer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ let rec type_ident_raise ?(imported_enums=true) ctx i p mode =
with
Not_found -> loop l
in
let e = loop ctx.m.module_types in
let e = (try loop ctx.m.curmod.m_types with Not_found -> loop ctx.m.module_types) in
if mode = MSet then
AKNo i
else
Expand Down Expand Up @@ -2945,7 +2945,7 @@ let load_macro ctx cpath f p =
let mloaded = Typeload.load_module ctx2 m p in
ctx2.m <- {
curmod = mloaded;
module_types = mloaded.m_types;
module_types = [];
module_using = [];
module_globals = PMap.empty;
wildcard_packages = [];
Expand Down

0 comments on commit 8e15c06

Please sign in to comment.