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

Jump to definition with let-punning #1796

Open
liam923 opened this issue Jul 8, 2024 · 1 comment
Open

Jump to definition with let-punning #1796

liam923 opened this issue Jul 8, 2024 · 1 comment

Comments

@liam923
Copy link
Contributor

liam923 commented Jul 8, 2024

Consider the program:

let (let+) x f = List.map f x

let f x =
  let+ x in
  x

Locating x on line 4 gives:

$ ocamlmerlin single locate -position 4:7 -filename test.ml < test.ml | jq .value
"Already at definition point"

In my opinion, for this command it would be better to treat x as the variable bound on line 3 rather than the one on line 4. I believe that if a user is querying the definition point of x on line 4, they likely want the definition that isn't on that line.

@voodoos
Copy link
Collaborator

voodoos commented Jul 9, 2024

Yes I agree, there is a similar frustrating thing happening when asking for the definition of punned record arguments (but in that case it is less clear which is the correct answer).

It suspect that the interesting node is given a ghost location, so Merlin chooses the other one.

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

No branches or pull requests

2 participants