4 The `warnUnused` <:MLBasisAnnotations:MLBasis annotation> can be used
5 to report unused identifiers. This can be useful for catching bugs
6 and for code maintenance (e.g., eliminating dead code). However, the
7 `warnUnused` annotation can sometimes behave in counter-intuitive
8 ways. This page gives some of the anomalies that have been reported.
10 * Functions whose only uses are recursive uses within their bodies are
16 fun foo () = foo () : unit
17 val bar = let fun baz () = baz () : unit in baz end
27 * Components of actual functor argument that are necessary to match
28 the functor argument signature but are unused in the body of the
29 functor are warned as unused:
33 functor Warning (type t val x : t) = struct
36 structure X = Warning (type t = int val x = 1)
45 * No component of a functor result is warned as unused. In the
46 following, the only uses of `f2` are to match the functor argument
47 signatures of `functor G` and `functor H` and there are no uses of
52 functor F(structure X : sig type t end) = struct
58 functor G(structure Y : sig
64 fun g (x : Y.t) = Y.f1 x
66 functor H(structure Y : sig
72 fun h (x : Y.t) = Y.f1 x
75 structure S = F(structure X = struct type t = unit end)
76 structure SG = G(structure Y = S)
77 structure SH = H(structure Y = S)