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
In 4.04 branch the unused module warning is unsound #7314
Comments
Comment author: bobot Severity "block" is a little too much, the warning is not enabled by default, so we could not activate it for Frama-c. |
Comment author: @lpw25 Even simpler example: module M = struct module O = M.N with interface: module M : sig end module O : sig end gives: File "bug.ml", line 2, characters 2-23: |
Comment author: bobot Could someone tag it with target version = 4.04? Thanks. |
Comment author: @gasche Of course, thanks for the ping. |
Comment author: @alainfrisch This is a missing call to mark_module_used in the Ldot case of Env.lookup_module. Will fix soon. |
Comment author: @alainfrisch Fixed on trunk in commit 772b92a, non-regression test added in commit e49f656. Fix (but not the test) cherry-picked to 4.04 in commit 9598de3. |
Comment author: bobot @Frisch Great thank you. Now we detect many many really unused module! Do you have a tip for suppressing the warning when a module is defined only for the side effect of the function application? module Empty = Register(...) |
Comment author: @lpw25 I have a patch to allow: module _ = ... for that case: https://github.com/lpw25/ocaml/tree/underscore_module but it still needs a little bit of work (and rebasing up to trunk). |
Comment author: bobot @lpw25 cool!! (perhaps @Frisch There is another warning 60 unsoundness with recursive module, but I'm not able to reduce the problem. At 1: File "src/libraries/datatype/datatype.ml", line 775, characters 0-287: If you have an idea without a reduced problem that would be great, otherwise I would try again to reduce it and open a proper bug. |
Comment author: @alainfrisch
include (... : sig end)
That would be very useful. I don't have an idea, upfront. |
Comment author: eponier The warning seems to appear as soon as you have recursive modules and they are not all declared in the signature. The excluded ones are reported as being useless. Simple contrived example: module M : sig module A : sig type t end end = With 4.04.0+beta2, "ocamlc -w A" returns "Warning 60 : unused module B". |
Original bug ID: 7314
Reporter: bobot
Assigned to: @alainfrisch
Status: resolved (set by @alainfrisch on 2016-08-23T09:00:48Z)
Resolution: fixed
Priority: normal
Severity: block
Target version: 4.04.0 +dev / +beta1 / +beta2
Fixed in version: 4.04.0 +dev / +beta1 / +beta2
Category: typing
Parent of: #7522
Monitored by: @Drup @gasche @yakobowski
Bug description
On the following code and interface:
with the warning 60 activated and branch 4.04 reports:
(line 9 is:
module Fold_ordered(P: sig module Id:Comparable end) =
)Steps to reproduce
boot/ocamlrun ./ocamlc -nostdlib -I stdlib -I byterun/ -w +A -o test3.cmi test3.mli
boot/ocamlrun ./ocamlc -nostdlib -I stdlib -I byterun/ -w +A -o test3 test3.ml
Additional information
The functors and the interface are needed
The text was updated successfully, but these errors were encountered: