Module Merlin_analysis.Destruct

Destruct at the moment works in two contexts:

  match e with
  | p1 -> _
  | ...

This matching will be exhaustive.

If e has a "package" type, it will be replaced by let module M = (val e) in _

  1. if your matching is not exhaustive, it will be made exhaustive.
  2. if your matching is exhaustive, it will refine the subpattern under the cursor if possible (i.e. if your cursor is on a variable or _ ).

* * *

Final remarks:

exception Not_allowed of string
exception Useless_refine
exception Nothing_to_do
exception Ill_typed
exception Wrong_parent of string

node ~env parents current_node returns a location indicating which portion of the buffer must be replaced and the string to replace it with.