merlin icon indicating copy to clipboard operation
merlin copied to clipboard

Jump to wrong definition when using record field punning with module path

Open liam923 opened this issue 10 months ago • 0 comments

module Foo = struct
  type t =
    { foo : int
    ; bar : int
    }

  let foo = "hello"
end

let _ =
  let foo = 10 in
  let bar = 10 in
  ({ Foo.foo; bar } : Foo.t)
;;

In this program, when a user jumps to definition on the Foo.foo on the last line, Merlin will erroneously take them to the definition of Foo.foo. Unintuitively, that foo is actually referring to the locally defined foo; the Foo. prefix simply does label disambiguation.

liam923 avatar Apr 29 '25 14:04 liam923