No sentence for a & that cannot arrive

This commit is contained in:
Joseph Ferano 2026-09-20 18:27:02 +07:00
parent b2d1df300b
commit 9fd1eb113f

View File

@ -283,12 +283,11 @@ let split_amp (items : Form.t list) : Form.t list * (string * Loc.t) option =
in
go [] items
(* Never handed a [&]: every list of items reaching here has been through
[split_amp], which stops at the first one and refuses every way of getting
the tail wrong itself. So there is no arm for it and no sentence about it. *)
let rec pat_of (f : Form.t) : pat =
match f.Form.v with
| Form.Sym "&" ->
(* Only reachable inside a [ ] that [split_amp] already walked, so a second
[&] is the one that has no name of its own to go with. *)
Loc.fail f.Form.loc "& appears twice in this parameter list"
| Form.Sym s -> Pname (s, f.Form.loc)
| Form.Vec items ->
let elems, rest = split_amp items in