Non-exhaustive lambda-patterns

I expect the following code to give a “this pattern-matching is not exhaustive” error:

type _ bar =
  | Flag : int bar
  | Other : 'a bar

let foo : unit -> int bar -> unit =
  fun () Other -> ()

And it does, in the toplevel and when compiled at the command-line. However, tuareg-mode reports “No errors”. (It does report an error if I change the code in minor ways, such as removing the unit argument, or moving the match against Other out of the fun into a let or match.)

This seems to me like a bug in something (although if it isn’t, please enlighten me!). But I don’t know where to report it, or how to figure out where to report it. Is it a bug in tuareg-mode, or a bug in the part of ocaml that interacts with it?

This is neither an issue with the compiler nor with tuareg-mode, but rather with Merlin which uses a patched typechecker to implement incremental, restartable typechecking of multiple buffers simultaneously. You should report it in the Merlin bug tracker.

Cheers,
Nicolas

That’s just what I wanted to know, thanks!