As described in the warning in the release highlights, the correct way to define a type-level tag is
type leaf = private [ `Leaf ]
(** Fantom type for typing the tree *)
type node = private [ `Node]
(** Fantom type for typing the tree *)
otherwise the type checker cannot prove in general that the two types are different.
Consider for instance,
module M: sig
type leaf
type node
type _ t = A: leaf t | B: node t
val a: node t
end = struct
type leaf
type node = leaf
type _ t = A: leaf t | B: node t
let a = A
end
let partial: M.(node t) -> unit = function
| B -> ()
let fail = partial M.a
Your version was relying on the special rule for abstract types defined in the current module that has been removed in OCaml 5.5 because it was very brittle and anti-modular.