I have an error when I compile this code with the new release of Ocaml 5.5.0:
type leaf
(** Fantom type for typing the tree *)
type node
(** Fantom type for typing the tree *)
type ('a, 'v) branch =
| Leaf : (leaf, 'v) branch
| Node : (_, 'v) branch * (unit * 'v) * (_, 'v) branch -> (node, 'v) branch
let rec splay : (node, 'any) branch -> unit =
fun t ->
let (Node (l, y, r)) = t in
ignore (l, y, r)
File “test.ml”, lines 13-14, characters 2-18:
13 | ..let (Node (l, y, r)) = t in
14 | ignore (l, y, r)
Warning 8 [partial-match]: this pattern-matching is not exhaustive.
Here is an example of a case that is not matched: Leaf
This code was compiling fine in 5.4.0
I do not see here how this branch could match, because the signature of the function prevent the case of the Leaf constructor. Is this because the new compiler is more strict ?