Fix PR#7321

master
Jacques Garrigue 2017-03-15 11:37:31 +09:00
parent 9028e3d8ee
commit 9112876c44
3 changed files with 15 additions and 0 deletions

View File

@ -83,6 +83,10 @@ Working version
- PR#7261: Warn on type constraints in GADT declarations
(Jacques Garrigue, report by Fabrice Le Botlan)
- PR#7321: Private type in signature clashes with type definition via
functor instantiation
(Jacques Garrigue, report by Markus Mottl)
- PR#7344: Inconsistent behavior with type annotations on let
(Jacques Garrigue, report by Leo White)

View File

@ -0,0 +1,8 @@
module type S = sig type 'a t end
module type Sp = sig type 'a t = private 'a array end
module Id (S : S) = S
module M : Sp = struct
include Id (struct type 'a t = 'a array end)
end

View File

@ -288,6 +288,9 @@ let type_declarations ?(equality = false) env name decl1 id decl2 =
else []
in
if err <> [] then err else
let need_variance =
abstr || decl1.type_private = Private || decl1.type_kind = Type_open in
if not need_variance then [] else
let abstr = abstr || decl2.type_private = Private in
let opn = decl2.type_kind = Type_open && decl2.type_manifest = None in
let constrained ty = not (Btype.(is_Tvar (repr ty))) in