Type inference makes module aliases declared in preamble leak in the .mli
When an alias for a module is declared in the preamble, if a type defined in this module is used in the return type of a starting symbol, then the alias is preferred in the .mli
to refer to this type rather than the original module name, whereas the alias is not defined in the .mli
.
In the following example, some_module.ml
is:
type t = C
The following grammar generates a .mli
that fails to compile, giving the type M.t
for the return value of s
, where M
is unbound.
%{
module M = Some_module
%}
%token T
%type <Some_module.t> s
%start s
%%
s:
| T
{ Some_module.C }