aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2016-01-24 15:15:16 +0100
committerPierre-Marie Pédrot2016-01-24 15:25:45 +0100
commit030ef2f015e5c592ea7599f0f98a715873c1e4d0 (patch)
treee92e1fb422863fa9c81022e9d71eebd9e44d6205
parente7852396a452f446135183ec3e1743b731d781c0 (diff)
Fixing bug #3826: "Incompatible module types" is uninformative.
-rw-r--r--toplevel/himsg.ml12
1 files changed, 11 insertions, 1 deletions
diff --git a/toplevel/himsg.ml b/toplevel/himsg.ml
index 7ddfd46cd1..89c33cb6fe 100644
--- a/toplevel/himsg.ml
+++ b/toplevel/himsg.ml
@@ -890,7 +890,17 @@ let explain_is_a_functor () =
str "Illegal use of a functor."
let explain_incompatible_module_types mexpr1 mexpr2 =
- str "Incompatible module types."
+ let open Declarations in
+ let rec get_arg = function
+ | NoFunctor _ -> 0
+ | MoreFunctor (_, _, ty) -> succ (get_arg ty)
+ in
+ let len1 = get_arg mexpr1.mod_type in
+ let len2 = get_arg mexpr2.mod_type in
+ if len1 <> len2 then
+ str "Incompatible module types: module expects " ++ int len2 ++
+ str " arguments, found " ++ int len1 ++ str "."
+ else str "Incompatible module types."
let explain_not_equal_module_paths mp1 mp2 =
str "Non equal modules."