Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type-expression crashes on function applications involving local types #1736

Open
ncik-roberts opened this issue Feb 22, 2024 · 0 comments
Open

Comments

@ncik-roberts
Copy link
Contributor

ncik-roberts commented Feb 22, 2024

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 ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant