Skip to content

Conversation

@Octachron
Copy link
Contributor

This PR adds support for the split world of OCaml 5.4, where the compiler has a richer Longident.t and Tuple types than the Astlib version.

@gasche gasche mentioned this pull request Oct 10, 2025
Copy link
Contributor

@gasche gasche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! This looks very reasonable to me, and extending the tests is a nice touch.

let string_of_lid lid = Format.asprintf "%a" Astlib.Pprintast.longident lid

(* Remove locations *)
let rec longident_without_loc =
Copy link
Contributor

@gasche gasche Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the point of this function really to remove the location, or is it to convert to the Astlib type? If the latter, then the name should reflect that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both? In particular, ppx_import uses List.assoc on Longident.t, which sounds dangerous on variants of Longident.t with a location.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In issue #99, @NathanReb commented:

I exposed Astlib.Longident.to/from_compiler in ppxlib.0.37.0 which you should be able to use if you'd like!

(My impression is that it would be nice to merge a fix relatively quickly to unblock users, so I would be okay with merging the current approach and cleaning things up later or not at all. @Octachron, a preference?)

@gasche
Copy link
Contributor

gasche commented Oct 10, 2025

The CI appears to be broken on this repository due to versions of github actions that are too old, I will send a separate PR to CI-golf this.

=> #101

@gasche gasche closed this Oct 10, 2025
@gasche gasche reopened this Oct 10, 2025
@gasche gasche merged commit e7ff301 into ocaml-ppx:master Oct 10, 2025
6 of 18 checks passed
ejgallego pushed a commit to ejgallego/ppx_import that referenced this pull request Oct 13, 2025
ejgallego pushed a commit to ejgallego/ppx_import that referenced this pull request Oct 13, 2025
ejgallego pushed a commit to ejgallego/ppx_import that referenced this pull request Oct 13, 2025
ejgallego added a commit that referenced this pull request Oct 13, 2025
[v1.x] Backport of "#100: Update for 5.4"
ejgallego added a commit to ejgallego/opam-repository that referenced this pull request Oct 13, 2025
CHANGES:

  * Support for OCaml 5.4 (ocaml-ppx/ppx_import#100, @Octachron, backport ocaml-ppx/ppx_import#104, @egallego)
  * Support for OCaml 4.5, 4.6, and 4.7 has been removed (ocaml-ppx/ppx_import#104, @egallego)
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.

2 participants