# module A = struct type t = A | B let x = B end;;
module A : sig type t = A | B val x : t end
# let test () =
match A.x with
| A as a -> `A_t a
| B when false -> `Onoes
| B -> if Random.bool () then `Onoes else `A_t B;;
val test : unit -> [> `A_t of A.t | `Onoes ] = <fun>
# let test () =
match A.x with
| B when false -> `Onoes
| A as a -> `A_t a
| B -> if Random.bool () then `Onoes else `A_t B;;
Characters 128-129:
| B -> if Random.bool () then `Onoes else `A_t B;;
^
Error: Unbound constructor B
Present since at least 4.03, all the way to trunk.
I would expect either both version to be accepted, or neither.
Also, if I pass -principal then both version get a type error (while one could have hoped to get warning 18 for the one that is accepted in normal mode).