-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Context
If a module's signature includes a module type with substitution, then values included may be reported at the location of the include. However, according to the current module type and include semantics for exported values, values declared in a module type should not be reported and those re-exported via include should only be reported for the original module (which is a module type here).
Example and reproduction
(* /tmp/limitations/sigincl/sigincl_lib.mli *)
module type T = sig
type t
val x : t
end
module M : T
module I : sig
include T with type t := unit
end(* /tmp/limitations/sigincl/sigincl_lib.ml *)
module type T = sig
type t
val x : t
end
module M = struct
type t = unit
let x = ()
end
module I = M$ ocamlopt -keep-locs -bin-annot sigincl_lib.mli sigincl_lib.ml
$ dead_code_analyzer --nothing -E all sigincl_lib.cmi sigincl_lib.cmt
Scanning files...
[DONE]
.> UNUSED EXPORTED VALUES:
=========================
/tmp/limitations/sigincl/sigincl_lib.mli:10: I.x
Nothing else to report in this section
--------------------------------------------------------------------------------
We can see that neither T.x nor M.x is reported. However, I.x is wrongly reported. The location /tmp/limitations/sigincl/sigincl_lib.mli:10 points to include T with type t := unit.
The same happens if the module type is defined in a different compilation unit.
The value is not reported if there is no substitution on the module type.
Reactions are currently unavailable