-
Notifications
You must be signed in to change notification settings - Fork 29
Fix incompatibility with OCaml 5.4 #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
CI failure is an OPAM failure: Huh? |
|
This is an issue in opam-repository. I've reported it upstream in ocaml/opam-repository#27955 and it'll be fixed at some point. However your CI system uses |
|
I believe the CI can be relaunched. I'm happy to handle the release on opam-repository once a tag is available for me to use if you don't have the time for that. |
|
This PR doesn't work, because the |
The type of long idents changed in OCaml 5.4. Instead of building longidents by hand, use the same trick as Zarith does: evaluate `#install_printer` directives built as strings. Note: the `Longident.unflatten` API would be great, but we cannot use it since the `Longident` module is not visible in the REPL. Fixes: #45
|
I took inspiration from ZArith and used ugly string evals. It seems to work and should be compatible with all OCaml versions. The code definitely needs a review, if only to agree that there are no better ways to go about this. |
|
Another option would be to update the type of Otherwise, going through let parse_longident s =
let install = Format.asprintf "#install_printer %s;;" s in
let l = Lexing.from_string install in
match !Toploop.parse_toplevel_phrase l with
| Parsetree.Ptop_dir { pdir_arg=Some ({pdira_desc=Pdir_ident id}); _ } -> id
| _ -> assert falseI am not sure if this is a less hackish solution however. |
|
For reference: Sherlocode shows 10 uses of My gut feeling is that there's no point in adding locations to each component of a longident and that it is still time to revert this change in OCaml 5.4. Otherwise, I'm sort of OK with the proposed fix to Num, based on string eval, and I'll let others deal with the other failures. |
|
Looking at those ten users:
|
|
Thanks for looking at these other uses of In accordance with @Octachron , I'm going to merge the current PR and make a release of Num, so as to unblock the OPAM packages for OCaml 5.4. |
The type of long idents changed in OCaml 5.4. Instead of building long idents by hand, use the
Longident.unflattenAPI, which has been available since OCaml 4.06.Fixes: #45