Skip to content

Commit

Permalink
Prepare for 5.2 AST bump
Browse files Browse the repository at this point in the history
  • Loading branch information
patricoferris committed Oct 19, 2024
1 parent 7bd056d commit 678b7c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
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

0 comments on commit 678b7c0

Please sign in to comment.