merlint: E351 uses the typed signature from .cmti (not the outline string)
Replaces the regex-on-type_sig heuristic with a typed walk of the
.cmti signature. The rule now flags a value iff the head of its
[Types.type_expr] resolves to [Stdlib.array] or [Stdlib.ref] -- so
type 'a ref = 'a list
val x : int ref
is correctly ignored (the local [ref] shadows the stdlib one), while
the previous string check would have fired on the literal " ref"
suffix.
Implementation:
- [Context.cmt : file -> Cmt_format.cmt_infos option] is a new lazy
field that reads the .cmti via [Merlin.Project.cmt]. First rule
consuming it is E351; others (E100 etc.) still use the text dump
from [Context.dump]. The field is cached so multiple rules share
a single cmt load.
- [rules/e351.ml] walks [Tsig_value] items and matches [Types.get_desc
vd.val_val.val_type] against [Predef.path_array] and
(since ref isn't a predef) against [Path.name] equal to ["ref"] /
["Stdlib.ref"].
- [lib/dune] adds [merlin-lib.ocaml_typing] so the rule can reference
[Ocaml_typing.Cmt_format]/[Types]/[Typedtree]/[Path]/[Predef].