# Non-exhaustive lambda-patterns

**URL:** <https://discuss.ocaml.org/t/non-exhaustive-lambda-patterns/10715>\
**Category:** Learning\
**Tags:** gadt\
**Created:** [October 27, 2022, 5:02pm UTC](https://discuss.ocaml.org/t/non-exhaustive-lambda-patterns/10715 "2022-10-27T17:02:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![viritrilbia](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/viritrilbia/32/3083_2.png) [@viritrilbia](https://discuss.ocaml.org/u/viritrilbia)\
**Post date:** [October 27, 2022, 5:02pm UTC](https://discuss.ocaml.org/t/non-exhaustive-lambda-patterns/10715/1 "2022-10-27T17:02:29Z")

</div>

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

```auto
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?

---

<div class="post-metadata">

**Author:** ![nojb](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/nojb/32/519_2.png) [@nojb](https://discuss.ocaml.org/u/nojb)\
**Post date:** [October 27, 2022, 8:18pm UTC](https://discuss.ocaml.org/t/non-exhaustive-lambda-patterns/10715/2 "2022-10-27T20:18:58Z")

</div>

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.

> **[Issues · ocaml/merlin](https://github.com/ocaml/merlin/issues)**
>
> Context sensitive completion for OCaml in Vim and Emacs - Issues · ocaml/merlin

Cheers,  
Nicolas

---

<div class="post-metadata">

**Author:** ![viritrilbia](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/viritrilbia/32/3083_2.png) [@viritrilbia](https://discuss.ocaml.org/u/viritrilbia)\
**Post date:** [October 27, 2022, 8:46pm UTC](https://discuss.ocaml.org/t/non-exhaustive-lambda-patterns/10715/3 "2022-10-27T20:46:18Z")

</div>

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