Skip to content

Migrate Ptyp_open from 502 to 501#625

Merged
patricoferris merged 2 commits intoocaml-ppx:mainfrom
patricoferris:migrate-module-opens
Mar 10, 2026
Merged

Migrate Ptyp_open from 502 to 501#625
patricoferris merged 2 commits intoocaml-ppx:mainfrom
patricoferris:migrate-module-opens

Conversation

@patricoferris
Copy link
Collaborator

A bug fix to support migration syntax like type t = M.(t) to the 501 AST via, our now, standard approach of using extensions. This really only impacts those who have not upgraded ppxlib to 0.36.0.

So, to help people, perhaps we backport this to a 0.35.1 release?

@NathanReb
Copy link
Collaborator

I'm not sure this would improve the situation much, especially since as you point out, our AST will not go back to 5.1. Now the error would be a Uninterpreted Extension .... The extension name would hint at ppxlib which is good but I still feel like it wouldn't beat a good error message there.
I think the quality of the uninterpreted extension error is balanced by the improved compatibility that we gain from allowing new features to be used alongside ppx-es but that won't be the case here since it would only happen when using older compilers.

How about simply improving the error message and backport it to 0.35 as you suggest?

@patricoferris
Copy link
Collaborator Author

ppxlib.0.35.0 is installable with OCaml 5.2 and 5.3 so it is possible (as was the case here: https://mastodon.social/@jonmsterling@mathstodon.xyz/116085163199163273) that you could use type t = M.(t) and expect to be preserved?

@NathanReb
Copy link
Collaborator

NathanReb commented Feb 17, 2026

Yeah I guess that's right, I didn't really expect to backport this kind of support but given how hard it can be to upgrade from 0.35 to 0.36, I'd say it's fine indeed!

A bug fix to support migration syntax like `type t = M.(t)` to the 501
AST via, our now, standard approach of using extensions. This really
only impacts those who have not upgraded ppxlib to 0.36.0.

Signed-off-by: Patrick Ferris <patrick@sirref.org>
Signed-off-by: Patrick Ferris <patrick@sirref.org>
@patricoferris patricoferris merged commit 9c4b385 into ocaml-ppx:main Mar 10, 2026
5 of 8 checks passed
@patricoferris
Copy link
Collaborator Author

I have cherry-picked these changes (tho they didn't apply cleanly) into a 0.35 branch: https://github.com/ocaml-ppx/ppxlib/tree/0.35

NathanReb pushed a commit to NathanReb/opam-repository that referenced this pull request Mar 20, 2026
CHANGES:

- Add support for OCaml 5.5 (ocaml-ppx/ppxlib#622, @patricoferris, @NathanReb)

- Add support for OCaml 5.4 bivariant type parameters, they can now be used
  alongside ppx-es. (ocaml-ppx/ppxlib#629, @NathanReb)

- Add `Attribute.Floating.declare_with_attr_loc` and `.declare_with_name_loc`,
  by analogy to the same functions at top level of `Attribute`. (ocaml-ppx/ppxlib#631, @ceastlund)

- Migrate `Ptyp_open` nodes using an extension point (ocaml-ppx/ppxlib#625, @patricoferris)

- Add Ast_builder and Ast_pattern utilities to manipulate encoded
  effect patterns (ocaml-ppx/ppxlib#624, @NathanReb)

- Fix a bug where ppat_effects would be encoded/decoded instead of copied by
  the 5.4 <-> 5.3 migrations (ocaml-ppx/ppxlib#624, @NathanReb)

- Fix infinite loop when duplicate attributes are present, raising
  an error instead (ocaml-ppx/ppxlib#613, @ceastlund, @patricoferris)
- Ignore extensions inside attributes for the unused extension check
  (ocaml-ppx/ppxlib#616, @Skepfyr)
- Fix a bug that inserted `Location.none` into `Longident`s when using OCaml
  5.4 and above (ocaml-ppx/ppxlib#619, @patricoferris)

- Add support for OCaml 5.4 labeled tuples, they can now be used alongside
  ppx-es. Also adds Ast_builder and Ast_pattern utilities to manipulate them.
  (ocaml-ppx/ppxlib#607, @NathanReb)
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