Skip to content

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

Open
@liam923

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions