Spurious warning 33: is this indeed a bug?

The compiler seems to emit irrelevant warnings 33 (disabled by default).

module M = struct
  type t = A | B
end

let () = match M.B with M.(A|B) -> ()
$ ocamlc -w +a tmp.ml
File "tmp.ml", line 5, characters 24-31:
Warning 33: unused open M.
File "tmp.ml", line 5, characters 24-31:
Warning 33: unused open M.

If you remove the local open, ocamlc will warn you that the constructors have been selected from M but that you should do an open, basically.
I was able to confirm this on 4.04 and 4.08 and have not found a discussion of it. Is it worth opening a bug report?

This was a known bug in 4.04.0. However, it should have been fixed; and I cannot reproduce the issue with 4.08 with your code example.

1 Like

Ah, you’re right, I seem to have failed my opam switch when I tested. It is fixed then. Thanks for your reply.