Permalink
Browse files

Do not add absolute paths for information added to

the local environment in Env.components_of_module_make.
Fixes the bug reported by Mark Shinwell on caml-devel,
on 2014-04-23. This bug was related to module aliases.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14674 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information...
1 parent 29b3443 commit 979fe8b8adb7a8d8c824e277b9cb7ca1c1cc9a77 Jacques Garrigue committed Apr 25, 2014
Showing with 22 additions and 3 deletions.
  1. +16 −0 testsuite/tests/typing-modules/aliases.ml
  2. +3 −0 testsuite/tests/typing-modules/aliases.ml.reference
  3. +3 −3 typing/env.ml
@@ -204,3 +204,19 @@ module type Alias = sig module N : sig end module M = N end;;
module F (X : sig end) = struct type t end;;
module type A = Alias with module N := F(List);;
module rec Bad : A = Bad;;
+
+(* Shinwell 2014-04-23 *)
+module B = struct
+ module R = struct
+ type t = string
+ end
+
+ module O = R
+end
+
+module K = struct
+ module E = B
+ module N = E.O
+end;;
+
+let x : K.N.t = "foo";;
@@ -371,4 +371,7 @@ Error: Module type declarations do not match:
module rec Bad : A = Bad;;
^
Error: Unbound module type A
+# module B : sig module R : sig type t = string end module O = R end
+module K : sig module E = B module N = E.O end
+# val x : K.N.t = "foo"
#
View
@@ -1187,7 +1187,7 @@ and components_of_module_maker (env, sub, path, mty) =
c.comp_labels <-
add_to_tbl descr.lbl_name (descr, nopos) c.comp_labels)
labels;
- env := store_type_infos None id path decl !env !env
+ env := store_type_infos None id (Pident id) decl !env !env
| Sig_exception(id, decl) ->
let decl' = Subst.exception_declaration sub decl in
let cstr = Datarepr.exception_descr path decl' in
@@ -1203,13 +1203,13 @@ and components_of_module_maker (env, sub, path, mty) =
let comps = components_of_module !env sub path mty in
c.comp_components <-
Tbl.add (Ident.name id) (comps, !pos) c.comp_components;
- env := store_module None id path md !env !env;
+ env := store_module None id (Pident id) md !env !env;
incr pos
| Sig_modtype(id, decl) ->
let decl' = Subst.modtype_declaration sub decl in
c.comp_modtypes <-
Tbl.add (Ident.name id) (decl', nopos) c.comp_modtypes;
- env := store_modtype None id path decl !env !env
+ env := store_modtype None id (Pident id) decl !env !env
| Sig_class(id, decl, _) ->
let decl' = Subst.class_declaration sub decl in
c.comp_classes <-

0 comments on commit 979fe8b

Please sign in to comment.