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

Ppxlib 5.2 AST bump #181

Open
wants to merge 1 commit 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: 5 additions & 3 deletions ppx/ppx_deriving_rpc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ module Of_rpc = struct
| { ptyp_desc = Ptyp_alias (_, _); _ } -> failwith "Ptyp_alias not handled"
| { ptyp_desc = Ptyp_class (_, _); _ } -> failwith "Ptyp_class not handled"
| { ptyp_desc = Ptyp_package _; _ } -> failwith "Ptyp_package not handled"
| { ptyp_desc = Ptyp_open _; _ } -> failwith "Ptyp_open not handled"


let str_of_type ~loc type_decl =
Expand Down Expand Up @@ -393,7 +394,7 @@ module Of_rpc = struct
[%expr
fun rpc ->
let rpc' = Rpc.lowerfn rpc in
[%e pexp_function (cases @ [ default ])] rpc']
[%e pexp_function_cases (cases @ [ default ])] rpc']
in
of_rpc
end
Expand Down Expand Up @@ -523,7 +524,7 @@ module Rpc_of = struct
| _ -> failwith "cannot be derived for")
|> List.rev
in
pexp_function cases
pexp_function_cases cases
| { ptyp_desc = Ptyp_any; _ } -> failwith "Ptyp_any not handled"
| { ptyp_desc = Ptyp_var name; _ } -> [%expr [%e evar ("poly_" ^ name)]]
| { ptyp_desc = Ptyp_poly (_, _); _ } -> failwith "Ptyp_poly not handled"
Expand All @@ -533,6 +534,7 @@ module Rpc_of = struct
| { ptyp_desc = Ptyp_alias (_, _); _ } -> failwith "Ptyp_alias not handled"
| { ptyp_desc = Ptyp_class (_, _); _ } -> failwith "Ptyp_class not handled"
| { ptyp_desc = Ptyp_package _; _ } -> failwith "Ptyp_package not handled"
| { ptyp_desc = Ptyp_open _; _ } -> failwith "Ptyp_open not handled"


(* | _ -> failwith "Error"*)
Expand Down Expand Up @@ -625,7 +627,7 @@ module Rpc_of = struct
| Pcstr_record _ -> failwith "record variants are not supported")
|> List.rev
in
pexp_function cases
pexp_function_cases cases
in
to_rpc
end
Expand Down
7 changes: 4 additions & 3 deletions ppx/ppx_deriving_rpcty.ml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ module Typ_of = struct
| { ptyp_desc = Ptyp_alias (_, _); _ } -> failwith "Ptyp_alias not handled"
| { ptyp_desc = Ptyp_class (_, _); _ } -> failwith "Ptyp_class not handled"
| { ptyp_desc = Ptyp_package _; _ } -> failwith "Ptyp_package not handled"
| { ptyp_desc = Ptyp_open _; _ } -> failwith "Ptyp_open not handled"
in
expr

Expand Down Expand Up @@ -269,15 +270,15 @@ module Typ_of = struct
else [ case ~guard:None ~lhs:ppat_any ~rhs:[%expr None] ]
in
let vpreview =
pexp_function
pexp_function_cases
([ case
~lhs:(ppat_construct (Located.mk (lident cname)) pat)
~guard:None
~rhs:[%expr Some [%e expr]]
]
@ vpreview_default)
in
let vreview = pexp_function [ case ~lhs:pat' ~guard:None ~rhs:constr ] in
let vreview = pexp_function_cases [ case ~lhs:pat' ~guard:None ~rhs:constr ] in
let variant =
[%expr
BoxedTag
Expand All @@ -304,7 +305,7 @@ module Typ_of = struct
Rresult.R.bind
(t.tget [%e contents])
[%e
pexp_function
pexp_function_cases
[ case ~lhs:pat' ~guard:None ~rhs:[%expr Rresult.R.ok [%e constr]]
]]]
in
Expand Down
Loading