Strange auto-reference in recursive modules in case of name conflict with a functor parameter #5965
Original bug ID: 5965
Using "module type of X" in the definition of the recursive module X is in general rejected by the type-checker:
It happens to somehow work when there is a name conflict with a functor parameter:
The code above type-check correctly, but the output of -i is strange, and not consistent with the output of -dtypedtree (the latter being only available in the trunk).
ocamlc -i returns
Note the triple wrapping
(Reproduced on 3.12.1, 4.00.1 and trunk)
Finally, the -dtypedtree output appears to indicate instead that the suspect occurrence of X is understood as a self-reference. Here is the output, curated to remove some noise:
Note that the arguments to
This bug was discovered and reported by Arthur Wendling.
The text was updated successfully, but these errors were encountered:
Comment author: @gasche
Thank you, Alain !
If I understand correctly, you exactly added the first restriction of Xavier's paper on recursive modules ( http://caml.inria.fr/pub/papers/xleroy-recursive_modules-03.pdf ), page 3, that was not necessary before the addition of "module type of" as module names did not appear in signatures (except in "open" and "with module M = .." that seems handled differently).