`type-expression` crashes on function applications involving local types
ncik-roberts opened this issue · 0 comments
ncik-roberts commented
Here is a test demonstrating the crash: https://github.com/ncik-roberts/merlin/tree/demonstrate-type-expression-bug
I'll reproduce an example in this issue as well. If you have a program like this:
(* In test.ml *)
let go (type a) () =
let f x : a -> int = assert false in
let g y = f y in
()
and then ask for the type of the f y
application expression:
$ merlin single type-expression -expression "f y" -position 4:13 -filename test.ml < test.ml
you get an assertion failure:
"File \"src/ocaml/typing/typecore.ml\", line 3144, characters 31-37: Assertion failed",
If you replace let f x : a -> int = ...
with let f x : int -> int = ...
, merlin correctly reports int
as the type. That is, this issue appears to be related to local types. You can also reproduce the issue by making a
a local type introduced by an existential unpack or by locally declaring a new type with let open struct type a = A end in ...
.