-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Explicit interface for a pack, "module type of" and type generativity #6304
Description
Original bug ID: 6304
Reporter: Julien Signoles
Assigned to: @garrigue
Status: acknowledged (set by @mshinwell on 2014-05-30T13:15:17Z)
Resolution: open
Priority: normal
Severity: minor
Category: typing
Related to: #6305
Monitored by: @gasche @diml @hcarty @yakobowski
Bug description
Consider the following files:
a.mli:
type t = X (* replacing 't' with a non-generative type works fine *)
b.ml:
let x = A.x
pack.mli
module A: module type of A
module B: module type of B
(* sig val x: A.t end (* this version works fine *) *)
$ ocamlc -c a.mli && ocamlc -c b.ml && ocamlc -c pack.mli && ocamlc -pack -o pack.cmo a.cmi b.cmo
File "none", line 1:
Error: The implementation (obtained by packing)
does not match the interface pack.mli:
In module B:
Modules do not match:
sig val x : A.t end
is not included in
sig val x : A.t end
In module B:
Values do not match: val x : A.t is not included in val x : A.t
It looks like a bug, in particular because the following version, which provides an explicit file pack.ml equivalent (?) to the generated pack, works fine:
pack.ml:
module A = A
module B = B
$ ocamlc -c a.mli && ocamlc -c b.ml && ocamlc -c pack.mli && ocamlc -c pack.ml