| 1 | diff -ruN a/expander/conversion.ml b/expander/conversion.ml
|
| 2 | |
| 3 | |
| 4 | @@ -59,7 +59,7 @@
|
| 5 | let maybe_apply_generic ~loc ~types ~binds maybe_arg cases =
|
| 6 | let expr =
|
| 7 | match maybe_arg with
|
| 8 | - | None -> pexp_function ~loc cases
|
| 9 | + | None -> pexp_function_cases ~loc cases
|
| 10 | | Some arg -> pexp_match ~loc arg cases
|
| 11 | in
|
| 12 | with_types ~loc ~types (with_let ~loc ~binds expr)
|
| 13 | diff -ruN a/expander/conversion.mli b/expander/conversion.mli
|
| 14 | |
| 15 | |
| 16 | @@ -2,7 +2,7 @@
|
| 17 | open! Ppxlib
|
| 18 |
|
| 19 | (** Sexp conversion function, expressed as either a single expression or as a collection
|
| 20 | - of [match] cases. Expressing as cases rather than wrapping directly in [pexp_function]
|
| 21 | + of [match] cases. Expressing as cases rather than wrapping directly in [pexp_function_cases]
|
| 22 | allows us to simplify some expressions built on this. *)
|
| 23 | type t
|
| 24 |
|
| 25 | diff -ruN a/expander/expand_of_sexp.ml b/expander/expand_of_sexp.ml
|
| 26 | |
| 27 | |
| 28 | @@ -187,7 +187,8 @@
|
| 29 | | { ptyp_desc = Ptyp_class (_, _); _ }
|
| 30 | | { ptyp_desc = Ptyp_alias (_, _); _ }
|
| 31 | | { ptyp_desc = Ptyp_package _; _ }
|
| 32 | - | { ptyp_desc = Ptyp_extension _; _ } ->
|
| 33 | + | { ptyp_desc = Ptyp_extension _; _ }
|
| 34 | + | { ptyp_desc = Ptyp_open _; _ } ->
|
| 35 | Location.raise_errorf ~loc "Type unsupported for ppx [of_sexp] conversion"
|
| 36 |
|
| 37 | (* Conversion of tuples *)
|
| 38 | @@ -702,7 +703,7 @@
|
| 39 | in
|
| 40 | let default_case = case ~lhs:(ppat_any ~loc) ~guard:None ~rhs:(eint ~loc (-1)) in
|
| 41 | let cases = List.concat [ field_cases; [ default_case ] ] in
|
| 42 | - pexp_function ~loc cases
|
| 43 | + pexp_function_cases ~loc cases
|
| 44 | ;;
|
| 45 |
|
| 46 | let create_arg_for_record_of_sexp td fields ~loc ~constructor =
|
| 47 | diff -ruN a/expander/expand_sexp_of.ml b/expander/expand_sexp_of.ml
|
| 48 | |
| 49 | |
| 50 | @@ -87,7 +87,8 @@
|
| 51 | | { ptyp_desc = Ptyp_class (_, _); _ }
|
| 52 | | { ptyp_desc = Ptyp_alias (_, _); _ }
|
| 53 | | { ptyp_desc = Ptyp_package _; _ }
|
| 54 | - | { ptyp_desc = Ptyp_extension _; _ } ->
|
| 55 | + | { ptyp_desc = Ptyp_extension _; _ }
|
| 56 | + | { ptyp_desc = Ptyp_open _; _ } ->
|
| 57 | Location.raise_errorf ~loc "Type unsupported for ppx [sexp_of] conversion"
|
| 58 |
|
| 59 | (* Conversion of tuples *)
|
| 60 | diff -ruN a/expander/helpers.ml b/expander/helpers.ml
|
| 61 | |
| 62 | |
| 63 | @@ -156,7 +156,7 @@
|
| 64 | let rec is_value_expression expr =
|
| 65 | match expr.pexp_desc with
|
| 66 | (* Syntactic values. *)
|
| 67 | - | Pexp_ident _ | Pexp_constant _ | Pexp_function _ | Pexp_fun _ | Pexp_lazy _ -> true
|
| 68 | + | Pexp_ident _ | Pexp_constant _ | Pexp_function _ | Pexp_lazy _ -> true
|
| 69 | (* Type-only wrappers; we check their contents. *)
|
| 70 | | Pexp_constraint (expr, (_ : core_type))
|
| 71 | | Pexp_coerce (expr, (_ : core_type option), (_ : core_type))
|
| 72 | diff -ruN a/expander/ppx_sexp_conv_grammar.ml b/expander/ppx_sexp_conv_grammar.ml
|
| 73 | |
| 74 | |
| 75 | @@ -312,7 +312,8 @@
|
| 76 | grammar_of_polymorphic_variant ~loc ~rec_flag ~tags_of_doc_comments rows)
|
| 77 | | Ptyp_poly _ -> unsupported ~loc "explicitly polymorphic types"
|
| 78 | | Ptyp_package _ -> unsupported ~loc "first-class module types"
|
| 79 | - | Ptyp_extension _ -> unsupported ~loc "unexpanded ppx extensions")
|
| 80 | + | Ptyp_extension _ -> unsupported ~loc "unexpanded ppx extensions"
|
| 81 | + | Ptyp_open _ -> unsupported ~loc "local module open")
|
| 82 | in
|
| 83 | grammar_of_type_tags core_type grammar ~tags_of_doc_comments
|
| 84 |
|