-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Menhir: Incorrect module dependency with type inference #2450
Comments
Yeah this is a known issue. I just had a look at the original issue. @fpottier, the The only workaround I know of is to add a dummy
to prevent OCaml from generating references to |
Hi @diml unfortunately it doesn't seem to be enough (?). In my case (about which I had already filed an issue), doing this yields the following warning if I update
Any idea? |
Does the build succeed? If yes, you can safely disable this warning. |
Yes thanks. |
BTW, we had a chat about this problem with @fpottier during ICFP this year. Unfortunately, there is no simple solution to this problem. The root issue here is that we are doing something weird in Dune with these So for now the best to do is to be patient and accept that things don't work as perfectly as they could. |
No worries. Using dune is such an improvement that I can endure a couple of tweaks, as long as I know the corresponding warnings can be safely ignored. What's more, thanks to your suggestion, I was able to remove those lines preventing Menhir to rely on type inference in the dune file, so that's cool. |
CHANGES: - inhibit warning 63 in release mode, see <ocaml/dune#2450>
As explained, this is a limitation of menhir and not dune. |
Problem: module Location conflicts with same one from ocaml-compiler-libs. Solution: separate files in lib/ intro three library - merlin_recovery -- public module with tools for recovery - custom_compiler_libs -- evil clone of ocaml-compiler-libs (also public for allowing merlin_recovery depends on it). It contains Location module and wrapped to avoid conflicts in the top-level namespace. - recover_parser -- parser of OCaml that used in src/driver Obstacles: menhir generates wrong qualification for modules due it relies on dune infering that makes weird things. However there is workarond: See ocaml/dune#2450
My parser is in a
foo
library, wrapped asFoo
by Dune. With a particular grammar, Menhir prefixes a reference to myAst
module withFoo.
. This is invalid because the parser itself is in thefoo
library .Here is a minimal example:
parser.mly
:ast.ml
:dune
:dune-project
:This results in the following error:
Dune uses
--infer-write-query
and--infer-read-reply
on Menhir to infer the types from the grammar. As expected, it also usesocamlc.opt -short-paths -i ...
to infer the types on the generated mock. However, the-short-paths
option, added in #1743 to fix #1504, doesn't seem to be enough to avoid the unwanted reference to the enclosingFoo
module.I've derived a small example from the mock that Menhir generated:
This results in:
Issue originally submitted at https://gitlab.inria.fr/fpottier/menhir/issues/26.
The text was updated successfully, but these errors were encountered: