Skip to content

Conversation

@arvidj
Copy link

@arvidj arvidj commented Dec 5, 2025

I'm not quite sure what I'm doing, but this seems to fix the following issue for me: ocaml/merlin#1910

Here is a test file:

type b = | A [@@deriving enum]

type t = { foo : string } [@@deriving create, make, eq, ord, show, iter]

let () =
  let (t : t) = create ~foo:"test" () in
  let (t' : t) = make ~foo:"test" in
  let (_ : bool) = equal t t' in
  let (_ : int) = compare t t' in
  let (_ : string) = show t in
  let () = iter t in
  ()

With this PR, I can use merlin to jump from the derived functions create, make, etc, to the type declaration with the deriving attribute.

Without, I would just get errors like: merlin-call-locate: 'show' seems to originate from '_none_' whose ML file could not be found.

I've made same fix in all included derivers, perhaps in quite a brutish way. Feedback welcome!

@arvidj arvidj changed the title ppx_deriving.create: set [with_default_loc] ppx_deriving.create: use [Ast_helper.with_default_loc] to derive create function with location info Dec 5, 2025
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

Successfully merging this pull request may close these issues.

1 participant