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
When warning 60 is activated, a used module is reported as "unused" #7684
Comments
Comment author: @gasche Reproduced under 4.06.0. |
Comment author: Iguernlala I forgot to say that trying to disable this warning with an annotation [Edited] |
Comment author: @mshinwell Here is another, probably related, example which I came across this week. w60.mlmodule type S = sig val f : unit -> unit end module F (X : S) = struct let f () = X.f () end module rec A : S = let f = A.f let () = f () w60.mlival f : unit -> unit Using a recent trunk: $ ocamlc w60.mli The warning is bogus, as evidenced by the exception, which shows that [B] was used. The bogus warning does not appear if the .mli file is absent. |
Comment author: @mshinwell As an aside: the following version produces a runtime exception: Fatal error: exception Undefined_recursive_module("w60.ml", 23, 2) This surprised me at first, but it appears to be related to Mantis 2629. It would indeed be nice if there were a compile-time check for this as suggested in that issue: module type S = sig val f : unit -> unit end module F (X : S) = struct let f = X.f end module rec A : S = let f = A.f let () = f () |
Duplicate of #7522 ? |
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc. |
This was fixed by #9393 |
Original bug ID: 7684
Reporter: Iguernlala
Status: acknowledged (set by @gasche on 2017-12-01T21:06:14Z)
Resolution: open
Priority: normal
Severity: minor
Version: 4.06.0
Category: misc
Monitored by: @nojb
Bug description
This happens with mutually recursive modules as shown in the example below. Module X1 is used in module M, and module M is exported in the interface. But, if warning 60 is set, an "unused module X1" warning is triggered when compiling as follows:
$ ocamlc -c -w +60 foo.mli foo.ml
File "foo.ml", line 8, characters 0-43:
Warning 60: unused module X1.
(* content of foo.ml *)
module type S = sig
type t
end
module rec M : S = struct
type t = X1 of X1.t
end
and X1 : S = struct
type t = M.t list
end
(* content of foo.mli *)
module type S = sig
type t
end
module M : S
The text was updated successfully, but these errors were encountered: