Skip to content
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

Add support for ppxlib 0.23.0 #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions metaquot/metaquot.ml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ let quote_of_path (path : Path.t) : Ppxlib.expression =
let name =
match Untypeast.lident_of_path path with
| Lident name | Ldot (Lident "Asttypes", name) -> name
| Ldot (Lident "Location", "t") -> "location"
| Ldot (Lident "Longident", "t") -> "longident"
| Ldot (Lident "Location", "t") (* ppxlib < 0.23.0 *)
| Ldot (Ldot (Lident "Astlib__", "Location"), "t") -> (* ppxlib >= 0.23.0 *)
Copy link

Choose a reason for hiding this comment

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

By any chance, is it possible to use the public path to Location, so Ppxlib_astlib.Location.t , instead of the private one, i.e. Astlib__.Location.t, here? And in case that's possible, same for Longident below.

"location"
| Ldot (Lident "Longident", "t") (* ppxlib < 0.23.0 *)
| Ldot (Ldot (Lident "Astlib__", "Longident"), "t") -> (* ppxlib >= 0.23.0 *)
"longident"
| lident ->
failwith (Format.asprintf "quote_of_path: %s"
(String.concat "." (Longident.flatten lident))) in
Expand Down
3 changes: 1 addition & 2 deletions ppx/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
(ppx_runtime_libraries compiler-libs)
; -warning 40: Constructor or label name used out of scope. (OCaml <=4.06.0)
(flags -w -40)
(libraries ocaml-migrate-parsetree compiler-libs metapp stdcompat
metaquot))
(libraries compiler-libs metapp stdcompat metaquot))
2 changes: 1 addition & 1 deletion tests/for/for_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ let () =
| { pstr_desc = Pstr_type (Recursive, [
{ ptype_name = { txt = "t1"; _ }; _};
{ ptype_name = { txt = "t2"; _ }; _};
{ ptype_name = { txt = "t3"; _ }; _}])} -> ()
{ ptype_name = { txt = "t3"; _ }; _}]); _} -> ()
| _ -> assert false