Is the following an expected change from OCaml 4.00.1 to 4.01.0?
Module Foo defines a private type and this module is included in Common. The signature within Common is defined using `module type of` with a constraint. The different behavior shown below occurs when the private type is a record, but not if it is a base type like string or int. In that case, the code compiles with both 4.00.1 and 4.01.0.
module Foo : sig
type t = private {a:int}
end = struct
type t = {a:int}
end
module Common : sig
module F : module type of Foo with type t = Foo.t
end = struct
module F = Foo
end
$ ocaml -version
The OCaml toplevel, version 4.01.0
(* no errors *)
Now, change version of OCaml being used.
$ ocaml -version
The OCaml toplevel, version 4.00.1
File "
a.ml", line 9, characters 6-33:
Error: Signature mismatch:
Modules do not match:
sig module F : sig type t = Foo.t = private { a : int; } end end
is not included in
sig module F : sig type t = Foo.t = { a : int; } end end
In module F:
Modules do not match:
sig type t = Foo.t = private { a : int; } end
is not included in
sig type t = Foo.t = { a : int; } end
In module F:
Type declarations do not match:
type t = Foo.t = private { a : int; }
is not included in
type t = Foo.t = { a : int; }
File "
a.ml", line 8, characters 37-51: Expected declaration
File "
a.ml", line 2, characters 7-26: Actual declaration
A private type would be revealed.