From 96fe384621335e57b2eacd718c1843e99f3837ea Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 24 Nov 2022 07:23:12 -0500 Subject: [PATCH] fix: do not hide lib interface module (#6549) Signed-off-by: Rudi Grinberg ps-id: f6931bc9-6cd8-4172-a865-fce524052fb7 Co-authored-by: Etienne Millon --- CHANGES.md | 2 ++ src/dune_rules/module_compilation.ml | 5 ++++- test/blackbox-tests/test-cases/alias-module-generated.t | 3 --- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 6601b56469a..0730da53162 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,8 @@ Unreleased ---------- +- Do not shadow library interface modules (#6549, fixes #6545, @rgrinberg) + - Move `$ dune ocaml-merlin -dump-config=$dir` to `$ dune ocaml merlin dump-config $dir`. (#6547, @rgrinberg) diff --git a/src/dune_rules/module_compilation.ml b/src/dune_rules/module_compilation.ml index d42f3e150e4..8dc037cc626 100644 --- a/src/dune_rules/module_compilation.ml +++ b/src/dune_rules/module_compilation.ml @@ -407,7 +407,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 -> [] diff --git a/test/blackbox-tests/test-cases/alias-module-generated.t b/test/blackbox-tests/test-cases/alias-module-generated.t index 09faf18da13..28148a64cca 100644 --- a/test/blackbox-tests/test-cases/alias-module-generated.t +++ b/test/blackbox-tests/test-cases/alias-module-generated.t @@ -17,9 +17,6 @@ wrap module is generated by dune. (** @canonical Foo.Bar *) module Bar = Foo__Bar - - module Foo = struct end - [@@deprecated "this module is shadowed"] The final `Foo` module should not be marked as deprecated/shadowed, since it does not shadow any module.