Skip to content

Commit

Permalink
fix: do not hide lib interface module (ocaml#6549)
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>

ps-id: f6931bc9-6cd8-4172-a865-fce524052fb7

Co-authored-by: Etienne Millon <[email protected]>
  • Loading branch information
rgrinberg and emillon committed Nov 24, 2022
1 parent c3b75bd commit 5decb9f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
3.6.1 (unreleased)
------------------

- Do not shadow library interface modules (#6549, fixes #6545, @rgrinberg)

3.6.0 (2022-11-14)
------------------

Expand Down
5 changes: 4 additions & 1 deletion src/dune_rules/module_compilation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,10 @@ module Alias_module = struct
{ local_name; obj_name })
in
let shadowed =
if Dune_project.dune_version project < (3, 5) then []
if
Dune_project.dune_version project < (3, 5)
|| Modules.lib_interface modules = None
then []
else
match Modules.alias_module modules with
| None -> []
Expand Down
22 changes: 22 additions & 0 deletions test/blackbox-tests/test-cases/alias-module-generated.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Test alias module for wrapped libraries that don't have a main module, i.e. the
wrap module is generated by dune.

$ cat >dune-project <<EOF
> (lang dune 3.5)
> EOF

$ cat >dune <<EOF
> (library
> (name foo))
> EOF
$ touch bar.ml

$ dune build
$ cat _build/default/foo.ml-gen
(* generated by dune *)

(** @canonical Foo.Bar *)
module Bar = Foo__Bar

The final `Foo` module should not be marked as deprecated/shadowed, since it
does not shadow any module.

0 comments on commit 5decb9f

Please sign in to comment.