dune icon indicating copy to clipboard operation
dune copied to clipboard

Add failing root_module test that produces duplicate modules.

Open mefyl opened this issue 3 years ago • 2 comments

Signed-off-by: mefyl [email protected]

mefyl avatar Sep 13 '22 09:09 mefyl

The error exhibited here is not the same as the one I get locally, which is the erroneous behavior I want to exhibit. I'm not sure why (yet)

File "test/blackbox-tests/test-cases/root-module-duplicate.t", line 1, characters 0-0:
Renamed _build/.sandbox/f5fdd33f4e465224997051cdf5d77d56/default/test/blackbox-tests/test-cases/root-module-duplicate.t to _build/.sandbox/f5fdd33f4e465224997051cdf5d77d56/default/test/blackbox-tests/test-cases/root-module-duplicate.t.corrected
_build/.sandbox/f5fdd33f4e465224997051cdf5d77d56/default/test/blackbox-tests/test-cases/root-module-duplicate.t.corrected --- Text
53                                      53 
54 Trigger the error.                   54 Trigger the error.
55                                      55 
56   $ dune build                       56   $ dune build
                                        57   File "root.ml-gen", line 15, characters 0-18:
                                        58   15 | module Logs = Logs
                                        59        ^^^^^^^^^^^^^^^^^^
                                        60   Error: Multiple definition of the module name Logs.
                                        61          Names must be unique in a given structure or signature.
                                        62   [1]

mefyl avatar Sep 13 '22 09:09 mefyl

It does now exhibit the incorrect behavior as expected.

mefyl avatar Sep 13 '22 15:09 mefyl

Thanks for the repro. The issue is caused by an unfortunate interaction between:

  1. The library layout in the logs package. It does not install sub libraries in separate directories.

  2. For findlib libraries, dune needs to guess what the entry modules are.

The result is that 2. cannot work if all the libraries are installed in one dir.

The simplest fix would be to change logs to install sub libraries in sub directories. This would have other advantages as well.

rgrinberg avatar Oct 05 '22 04:10 rgrinberg

I merged your test case with a few small edits.

rgrinberg avatar Oct 05 '22 14:10 rgrinberg