summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2015-09-09 06:37:16 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2015-09-09 06:37:16 +0000
commit65435149d2544f22f1df9db08565178a2e6abde3 (patch)
tree8916df40b463217a0e9988c761a65a9bb1354e2f
parenteeced22d266caca85f6d0de1f950bfad4ed2ce81 (diff)
downloadocaml-65435149d2544f22f1df9db08565178a2e6abde3.tar.gz
Fix PR#6982
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16410 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--Changes1
-rw-r--r--testsuite/tests/typing-modules-bugs/pr6982_ok.ml26
-rw-r--r--typing/typemod.ml2
3 files changed, 29 insertions, 0 deletions
diff --git a/Changes b/Changes
index 3db552d49f..0a72ecbe50 100644
--- a/Changes
+++ b/Changes
@@ -168,6 +168,7 @@ Bug fixes:
- PR#6931: Incorrect error message
- PR#6938: fix regression on "%047.27{l,L,n}{d,i,x,X,o,u}"
(BenoƮt Vaugon, report by Arduino Cascella)
+- PR#6982: unexpected type error when packing a module alias
- GPR#205: Clear caml_backtrace_last_exn before registering as root (report
and fix by Frederic Bour)
- GPR#220: minor -dsource error on recursive modules
diff --git a/testsuite/tests/typing-modules-bugs/pr6982_ok.ml b/testsuite/tests/typing-modules-bugs/pr6982_ok.ml
new file mode 100644
index 0000000000..7e24940a03
--- /dev/null
+++ b/testsuite/tests/typing-modules-bugs/pr6982_ok.ml
@@ -0,0 +1,26 @@
+module A = struct
+ module type A_S = sig
+ end
+
+ type t = (module A_S)
+end
+
+module type S = sig type t end
+
+let f (type a) (module X : S with type t = a) = ()
+
+let _ = f (module A) (* ok *)
+
+module A_annotated_alias : S with type t = (module A.A_S) = A
+
+let _ = f (module A_annotated_alias) (* ok *)
+let _ = f (module A_annotated_alias : S with type t = (module A.A_S)) (* ok *)
+
+module A_alias = A
+module A_alias_expanded = struct include A_alias end
+
+let _ = f (module A_alias_expanded : S with type t = (module A.A_S)) (* ok *)
+let _ = f (module A_alias_expanded) (* ok *)
+
+let _ = f (module A_alias : S with type t = (module A.A_S)) (* doesn't type *)
+let _ = f (module A_alias) (* doesn't type either *)
diff --git a/typing/typemod.ml b/typing/typemod.ml
index b73bf0616e..75e3335e1a 100644
--- a/typing/typemod.ml
+++ b/typing/typemod.ml
@@ -1518,6 +1518,8 @@ let type_package env m p nl tl =
let (mp, env) =
match modl.mod_desc with
Tmod_ident (mp,_) -> (mp, env)
+ | Tmod_constraint ({mod_desc=Tmod_ident (mp,_)}, mty, Tmodtype_implicit, _)
+ -> (mp, env) (* PR#6982 *)
| _ ->
let (id, new_env) = Env.enter_module ~arg:true "%M" modl.mod_type env in
(Pident id, new_env)