I wonder if it is possible to make the OCaml compiler to report unused module aliases?
For example, in the following file (test.ml), I want to enable ocamlc to report the warnings that two module aliases S and L are unused.
module S = String
module L = List
let foo () =
let a = 1 in
let b = 2 in
a + b
;;
The only relevant warning options that I can find from ocamlc -warn-help are 31 (31 [module-linked-twice] A module is linked twice in the same executable) and 60 ([unused-module] Unused module declaration).
However, when running the following command, ocamlc doesn’t report any warning.
$ ocamlc -w +31+60+66 test.ml
# no warning is reported
Does anyone know how to enable ocamlc to report such warnings that module S = String and module L = List are unused?
Thank you for spending your time to read my question!
For executables, you can set (executables_implicit_empty_intf true) in your dune-project file to automatically generate an empty interface whenever one does not exist already (see Stanza Reference — Dune documentation).