diff --git a/CHANGES.md b/CHANGES.md index 77194409..a7446089 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,7 @@ unreleased ------------------ - +- Allow users to vendor `ppxlib` as-is, as well as `ppx_sexp_conv` in the same project (#386, @kit-ty-kate) 0.29.0 (06/02/2023) ------------------ diff --git a/bench/vendored/dune b/bench/vendored/dune deleted file mode 100644 index 806de809..00000000 --- a/bench/vendored/dune +++ /dev/null @@ -1 +0,0 @@ -(vendored_dirs *) diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/.ocamlformat-ignore b/bench/vendored/ppx_sexp_conv.v0.15.1/.ocamlformat-ignore new file mode 100644 index 00000000..1d085cac --- /dev/null +++ b/bench/vendored/ppx_sexp_conv.v0.15.1/.ocamlformat-ignore @@ -0,0 +1 @@ +** diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/dune-project b/bench/vendored/ppx_sexp_conv.v0.15.1/dune-project deleted file mode 100644 index a32e20f0..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/dune-project +++ /dev/null @@ -1 +0,0 @@ -(lang dune 2.5) \ No newline at end of file diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/expander/dune b/bench/vendored/ppx_sexp_conv.v0.15.1/expander/dune index 5d9e3af9..ec4bb765 100644 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/expander/dune +++ b/bench/vendored/ppx_sexp_conv.v0.15.1/expander/dune @@ -1,5 +1,8 @@ -(library (name ppx_sexp_conv_expander) (public_name ppx_sexp_conv.expander) - (enabled_if (>= %{ocaml_version} "4.10.0")) - (libraries base ppxlib ppxlib.metaquot_lifters) +(library + (name ppx_sexp_conv_expander) + (enabled_if + (>= %{ocaml_version} "4.10.0")) + (libraries base ppxlib ppxlib.astlib ppxlib.metaquot_lifters) (ppx_runtime_libraries ppx_sexp_conv.runtime-lib sexplib0) - (preprocess (pps ppxlib.metaquot ppxlib.traverse))) \ No newline at end of file + (preprocess + (pps ppxlib.metaquot ppxlib.traverse))) diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/runtime-lib/dune b/bench/vendored/ppx_sexp_conv.v0.15.1/runtime-lib/dune index 41625cd9..8f266967 100644 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/runtime-lib/dune +++ b/bench/vendored/ppx_sexp_conv.v0.15.1/runtime-lib/dune @@ -1,2 +1,4 @@ -(library (name ppx_sexp_conv_lib) (public_name ppx_sexp_conv.runtime-lib) - (libraries sexplib0) (preprocess no_preprocessing)) \ No newline at end of file +(library + (name ppx_sexp_conv_lib) + (libraries sexplib0) + (preprocess no_preprocessing)) diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/src/dune b/bench/vendored/ppx_sexp_conv.v0.15.1/src/dune index 16f5db20..c4b2d8f5 100644 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/src/dune +++ b/bench/vendored/ppx_sexp_conv.v0.15.1/src/dune @@ -1,3 +1,7 @@ -(library (name ppx_sexp_conv) (public_name ppx_sexp_conv) (kind ppx_deriver) - (enabled_if (>= %{ocaml_version} "4.10.0")) - (libraries ppxlib ppx_sexp_conv_expander) (preprocess no_preprocessing)) \ No newline at end of file +(library + (name ppx_sexp_conv) + (kind ppx_deriver) + (enabled_if + (>= %{ocaml_version} "4.10.0")) + (libraries ppxlib ppx_sexp_conv_expander) + (preprocess no_preprocessing)) diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/dune b/bench/vendored/ppx_sexp_conv.v0.15.1/test/dune deleted file mode 100644 index 1c362916..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/dune +++ /dev/null @@ -1,4 +0,0 @@ -(library (name ppx_sexp_conv_test) - (libraries base expect_test_helpers_core sexplib) (flags :standard -w -30) - (preprocess - (pps ppxlib ppx_sexp_conv ppx_compare ppx_here ppx_inline_test ppx_expect))) \ No newline at end of file diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/errors.mlt b/bench/vendored/ppx_sexp_conv.v0.15.1/test/errors.mlt deleted file mode 100644 index df3f08d0..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/errors.mlt +++ /dev/null @@ -1,265 +0,0 @@ -type t = { a : int [@sexp_drop_default] [@sexp.omit_nil] } [@@deriving sexp_of] - -[%%expect - {| -Line _, characters _-_: -Error: The following elements are mutually exclusive: sexp.sexp_drop_default sexp.omit_nil -|}] - -type t = { a : int list [@sexp.list] [@sexp.omit_nil] } [@@deriving sexp_of] - -[%%expect - {| -Line _, characters _-_: -Error: The following elements are mutually exclusive: sexp.omit_nil [@sexp.list] -|}] - -type t = { a : int [@default 0] [@sexp.omit_nil] } [@@deriving of_sexp] - -[%%expect - {| -Line _, characters _-_: -Error: The following elements are mutually exclusive: sexp.default sexp.omit_nil -|}] - -type t = int [@@deriving sexp] [@@sexp.allow_extra_fields] - -[%%expect - {| -Line _, characters _-_: -Error: ppx_sexp_conv: [@@allow_extra_fields] is only allowed on records. -|}] - -type 'a t = 'a option = - | None - | Some of 'a -[@@deriving sexp] [@@sexp.allow_extra_fields] - -[%%expect - {| -Line _, characters _-_: -Error: ppx_sexp_conv: [@@allow_extra_fields] is only allowed on records. -|}] - -type 'a t = Some of { a : int } [@@deriving sexp] [@@sexp.allow_extra_fields] - -[%%expect - {| -Line _, characters _-_: -Error: ppx_sexp_conv: [@@allow_extra_fields] only works on records. For inline records, do: type t = A of { a : int } [@allow_extra_fields] | B [@@deriving sexp] -|}] - -type 'a t = - | Some of { a : int } - | None [@sexp.allow_extra_fields] -[@@deriving sexp] - -[%%expect - {| -Line _, characters _-_: -Error: ppx_sexp_conv: [@allow_extra_fields] is only allowed on inline records. -|}] - -type t = - | Non - | Som of { next : t [@default Non] [@sexp_drop_default.equal] } -[@@deriving sexp] - -[%%expect - {| -Line _, characters _-_: -Error: [@sexp_drop_default.equal] was used, but the type of the field contains a type defined in the current recursive block: t. -This is not supported. -Consider using [@sexp_drop_if _] or [@sexp_drop_default.sexp] instead. -|}] - -type nonrec 'a t = { foo : 'a option [@default None] [@sexp_drop_default.equal] } -[@@deriving sexp] - -[%%expect - {| -Line _, characters _-_: -Error: [@sexp_drop_default.equal] was used, but the type of the field contains a type variable: 'a. -Comparison is not avaiable for type variables. -Consider using [@sexp_drop_if _] or [@sexp_drop_default.sexp] instead. -|}] - -open Base - -type t = { a : int [@default 8] [@sexp_drop_default] } [@@deriving sexp_of] - -[%%expect - {| -Line _, characters _-_: -Error (warning 22 [preprocessor]): [@sexp_drop_default] is deprecated: please use one of: -- [@sexp_drop_default f] and give an explicit equality function ([f = Poly.(=)] corresponds to the old behavior) -- [@sexp_drop_default.compare] if the type supports [%compare] -- [@sexp_drop_default.equal] if the type supports [%equal] -- [@sexp_drop_default.sexp] if you want to compare the sexp representations -|}] - -type t = { x : unit [@sexp.opaque] } [@@deriving sexp_of] -type t = { x : unit [@sexp.opaque] } [@@deriving of_sexp] -type t = { x : unit [@sexp.opaque] } [@@deriving sexp_grammar] - -[%%expect - {| -Line _, characters _-_: -Error: Attribute `sexp.opaque' was not used. -Hint: `sexp.opaque' is available for core types but is used here in the -context of a label declaration. -Did you put it at the wrong level? -Line _, characters _-_: -Error: Attribute `sexp.opaque' was not used. -Hint: `sexp.opaque' is available for core types but is used here in the -context of a label declaration. -Did you put it at the wrong level? -Line _, characters _-_: -Error: Attribute `sexp.opaque' was not used. -Hint: `sexp.opaque' is available for core types but is used here in the -context of a label declaration. -Did you put it at the wrong level? -|}] - -type t = { x : unit [@sexp.option] } [@@deriving sexp_of] -type t = { x : unit [@sexp.option] } [@@deriving of_sexp] -type t = { x : unit [@sexp.option] } [@@deriving sexp_grammar] - -[%%expect - {| -Line _, characters _-_: -Error: ppx_sexp_conv: [@sexp.option] is only allowed on type [_ option]. -Line _, characters _-_: -Error: ppx_sexp_conv: [@sexp.option] is only allowed on type [_ option]. -Line _, characters _-_: -Error: ppx_sexp_conv: [@sexp.option] is only allowed on type [_ option]. -|}] - -type t = { x : unit [@sexp.list] } [@@deriving sexp_of] -type t = { x : unit [@sexp.list] } [@@deriving of_sexp] -type t = { x : unit [@sexp.list] } [@@deriving sexp_grammar] - -[%%expect - {| -Line _, characters _-_: -Error: ppx_sexp_conv: [@sexp.list] is only allowed on type [_ list]. -Line _, characters _-_: -Error: ppx_sexp_conv: [@sexp.list] is only allowed on type [_ list]. -Line _, characters _-_: -Error: ppx_sexp_conv: [@sexp.list] is only allowed on type [_ list]. -|}] - -type t = { x : unit [@sexp.array] } [@@deriving sexp_of] -type t = { x : unit [@sexp.array] } [@@deriving of_sexp] -type t = { x : unit [@sexp.array] } [@@deriving sexp_grammar] - -[%%expect - {| -Line _, characters _-_: -Error: ppx_sexp_conv: [@sexp.array] is only allowed on type [_ array]. -Line _, characters _-_: -Error: ppx_sexp_conv: [@sexp.array] is only allowed on type [_ array]. -Line _, characters _-_: -Error: ppx_sexp_conv: [@sexp.array] is only allowed on type [_ array]. -|}] - -type t = { x : unit [@sexp.bool] } [@@deriving sexp_of] -type t = { x : unit [@sexp.bool] } [@@deriving of_sexp] -type t = { x : unit [@sexp.bool] } [@@deriving sexp_grammar] - -[%%expect - {| -Line _, characters _-_: -Error: ppx_sexp_conv: [@sexp.bool] is only allowed on type [bool]. -Line _, characters _-_: -Error: ppx_sexp_conv: [@sexp.bool] is only allowed on type [bool]. -Line _, characters _-_: -Error: ppx_sexp_conv: [@sexp.bool] is only allowed on type [bool]. -|}] - -type t = A of unit [@sexp.list] [@@deriving sexp_of] -type t = A of unit [@sexp.list] [@@deriving of_sexp] -type t = A of unit [@sexp.list] [@@deriving sexp_grammar] - -[%%expect - {| -Line _, characters _-_: -Error: ppx_sexp_conv: [@sexp.list] is only allowed on type [_ list]. -Line _, characters _-_: -Error: ppx_sexp_conv: [@sexp.list] is only allowed on type [_ list]. -Line _, characters _-_: -Error: ppx_sexp_conv: [@sexp.list] is only allowed on type [_ list]. -|}] - -type t = [ `A of unit [@sexp.list] ] [@@deriving sexp_of] -type t = [ `A of unit [@sexp.list] ] [@@deriving of_sexp] -type t = [ `A of unit [@sexp.list] ] [@@deriving sexp_grammar] - -[%%expect - {| -Line _, characters _-_: -Error: ppx_sexp_conv: [@sexp.list] is only allowed on type [_ list]. -Line _, characters _-_: -Error: ppx_sexp_conv: [@sexp.list] is only allowed on type [_ list]. -Line _, characters _-_: -Error: ppx_sexp_conv: [@sexp.list] is only allowed on type [_ list]. -|}] - -let (_ : _) = [%sexp_grammar: 'k -> 'v -> ('k * 'v) list] - -[%%expect {| -|}] - -let (_ : _) = [%sexp_grammar: < for_all : 'k 'v. ('k * 'v) list > ] - -[%%expect {| -Line _, characters _-_: -Error: sexp_grammar: object types are unsupported -|}] - -let (_ : _) = [%sexp_grammar: < other : 'k 'v. ('k * 'v) list > ] - -[%%expect {| -Line _, characters _-_: -Error: sexp_grammar: object types are unsupported -|}] - -type t = < for_all : 'k 'v. ('k * 'v) list > [@@deriving sexp_grammar] - -[%%expect {| -Line _, characters _-_: -Error: sexp_grammar: object types are unsupported -|}] - -type t = < other : 'k 'v. ('k * 'v) list > [@@deriving sexp_grammar] - -[%%expect {| -Line _, characters _-_: -Error: sexp_grammar: object types are unsupported -|}] - -type t = T : 'a -> t [@@deriving sexp_grammar] - -[%%expect - {| -Line _, characters _-_: -Error: Unbound value _'a_sexp_grammar -Hint: Did you mean char_sexp_grammar, int_sexp_grammar or ref_sexp_grammar? -|}] - -(* If we can sensibly derive [sexp_grammar], we might as well, because the user might - still be able to pair it with a consistent hand-written [t_of_sexp]. *) -type _ t = T : int -> string t [@@deriving sexp_grammar] - -[%%expect {| -|}] - -type _ t = T : int -> string t [@@deriving of_sexp] - -[%%expect - {| -Line _, characters _-_: -Error: This expression has type string t - but an expression was expected of type a__192_ t - Type string is not compatible with type a__192_ -|}] diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/examples.mlt b/bench/vendored/ppx_sexp_conv.v0.15.1/test/examples.mlt deleted file mode 100644 index 6638f5c5..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/examples.mlt +++ /dev/null @@ -1,58 +0,0 @@ -module Position_for_polymorphic_variant_errors = struct - type t1 = [ `A ] [@@deriving of_sexp] - type t2 = [ `B ] [@@deriving of_sexp] - type t3 = A of [ t1 | t2 ] [@@deriving of_sexp] - - let (_ : t3) = t3_of_sexp (List [ Atom "A"; Atom "C" ]) -end - -[%%expect - {| -Exception: -(Of_sexp_error - "examples.mlt.Position_for_polymorphic_variant_errors.t3_of_sexp: no matching variant found" - (invalid_sexp C)) -|}] - -let _ = [%sexp_of: 'a] - -[%%expect {| -Line _, characters _-_: -Error: ppx_sexp_conv: unbound type variable 'a -|}] - -let _ = [%of_sexp: 'a] - -[%%expect {| -Line _, characters _-_: -Error: ppx_sexp_conv: unbound type variable 'a -|}] - -let _ = [%sexp (() : 'a)] - -[%%expect {| -Line _, characters _-_: -Error: ppx_sexp_conv: unbound type variable 'a -|}] - -type 'a t = - | None - | Something_else of { value : 'a } -[@@deriving sexp] - -[%%expect {||}] - -module Record_with_defaults = struct - open Sexplib0.Sexp_conv - - let a_field = "a_field" - let b_field = "b_field" - - type record_with_defaults = - { a : string [@default a_field] - ; b : string [@default b_field] - } - [@@deriving of_sexp] -end - -[%%expect {||}] diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/expansion.ml b/bench/vendored/ppx_sexp_conv.v0.15.1/test/expansion.ml deleted file mode 100644 index 705ebb8a..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/expansion.ml +++ /dev/null @@ -1,2457 +0,0 @@ -open! Base - -module Abstract = struct - type t [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - - let t_of_sexp = - (let error_source__002_ = "expansion.ml.Abstract.t" in - fun x__003_ -> Sexplib0.Sexp_conv_error.empty_type error_source__002_ x__003_ - : Sexplib0.Sexp.t -> t) - ;; - - let _ = t_of_sexp - let sexp_of_t = (fun _ -> assert false : t -> Sexplib0.Sexp.t) - let _ = sexp_of_t - - [@@@end] -end - -module Tuple = struct - type t = int * int * int [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - - let t_of_sexp = - (let error_source__012_ = "expansion.ml.Tuple.t" in - function - | Sexplib0.Sexp.List [ arg0__005_; arg1__006_; arg2__007_ ] -> - let res0__008_ = int_of_sexp arg0__005_ - and res1__009_ = int_of_sexp arg1__006_ - and res2__010_ = int_of_sexp arg2__007_ in - res0__008_, res1__009_, res2__010_ - | sexp__011_ -> - Sexplib0.Sexp_conv_error.tuple_of_size_n_expected error_source__012_ 3 sexp__011_ - : Sexplib0.Sexp.t -> t) - ;; - - let _ = t_of_sexp - - let sexp_of_t = - (fun (arg0__013_, arg1__014_, arg2__015_) -> - let res0__016_ = sexp_of_int arg0__013_ - and res1__017_ = sexp_of_int arg1__014_ - and res2__018_ = sexp_of_int arg2__015_ in - Sexplib0.Sexp.List [ res0__016_; res1__017_; res2__018_ ] - : t -> Sexplib0.Sexp.t) - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Record = struct - type t = - { a : int - ; b : int - ; c : int - } - [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - - let t_of_sexp = - (let error_source__036_ = "expansion.ml.Record.t" in - function - | Sexplib0.Sexp.List field_sexps__021_ as sexp__020_ -> - let a__022_ = Stdlib.ref Stdlib.Option.None - and b__024_ = Stdlib.ref Stdlib.Option.None - and c__026_ = Stdlib.ref Stdlib.Option.None - and duplicates__028_ = Stdlib.ref [] - and extra__029_ = Stdlib.ref [] in - let rec iter__037_ = function - | Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom field_name__030_ :: (([] | [ _ ]) as _field_sexps__032_)) - :: tail__038_ -> - let _field_sexp__031_ () = - match _field_sexps__032_ with - | [ x__039_ ] -> x__039_ - | [] -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__036_ - sexp__020_ - | _ -> assert false - in - (match field_name__030_ with - | "a" -> - (match Stdlib.( ! ) a__022_ with - | Stdlib.Option.None -> - let _field_sexp__031_ = _field_sexp__031_ () in - let fvalue__035_ = int_of_sexp _field_sexp__031_ in - Stdlib.( := ) a__022_ (Stdlib.Option.Some fvalue__035_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__028_ - (field_name__030_ :: Stdlib.( ! ) duplicates__028_)) - | "b" -> - (match Stdlib.( ! ) b__024_ with - | Stdlib.Option.None -> - let _field_sexp__031_ = _field_sexp__031_ () in - let fvalue__034_ = int_of_sexp _field_sexp__031_ in - Stdlib.( := ) b__024_ (Stdlib.Option.Some fvalue__034_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__028_ - (field_name__030_ :: Stdlib.( ! ) duplicates__028_)) - | "c" -> - (match Stdlib.( ! ) c__026_ with - | Stdlib.Option.None -> - let _field_sexp__031_ = _field_sexp__031_ () in - let fvalue__033_ = int_of_sexp _field_sexp__031_ in - Stdlib.( := ) c__026_ (Stdlib.Option.Some fvalue__033_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__028_ - (field_name__030_ :: Stdlib.( ! ) duplicates__028_)) - | _ -> - if Stdlib.( ! ) Sexplib0.Sexp_conv.record_check_extra_fields - then Stdlib.( := ) extra__029_ (field_name__030_ :: Stdlib.( ! ) extra__029_) - else ()); - iter__037_ tail__038_ - | ((Sexplib0.Sexp.Atom _ | Sexplib0.Sexp.List _) as sexp__020_) :: _ -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__036_ - sexp__020_ - | [] -> () - in - iter__037_ field_sexps__021_; - (match Stdlib.( ! ) duplicates__028_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_duplicate_fields - error_source__036_ - (Stdlib.( ! ) duplicates__028_) - sexp__020_ - | [] -> - (match Stdlib.( ! ) extra__029_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_extra_fields - error_source__036_ - (Stdlib.( ! ) extra__029_) - sexp__020_ - | [] -> - (match Stdlib.( ! ) a__022_, Stdlib.( ! ) b__024_, Stdlib.( ! ) c__026_ with - | ( Stdlib.Option.Some a__023_ - , Stdlib.Option.Some b__025_ - , Stdlib.Option.Some c__027_ ) -> { a = a__023_; b = b__025_; c = c__027_ } - | _ -> - Sexplib0.Sexp_conv_error.record_undefined_elements - error_source__036_ - sexp__020_ - [ Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) a__022_) Stdlib.Option.None, "a" - ; Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) b__024_) Stdlib.Option.None, "b" - ; Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) c__026_) Stdlib.Option.None, "c" - ]))) - | Sexplib0.Sexp.Atom _ as sexp__020_ -> - Sexplib0.Sexp_conv_error.record_list_instead_atom error_source__036_ sexp__020_ - : Sexplib0.Sexp.t -> t) - ;; - - let _ = t_of_sexp - - let sexp_of_t = - (fun { a = a__041_; b = b__043_; c = c__045_ } -> - let bnds__040_ = [] in - let bnds__040_ = - let arg__046_ = sexp_of_int c__045_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "c"; arg__046_ ] :: bnds__040_ - in - let bnds__040_ = - let arg__044_ = sexp_of_int b__043_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "b"; arg__044_ ] :: bnds__040_ - in - let bnds__040_ = - let arg__042_ = sexp_of_int a__041_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "a"; arg__042_ ] :: bnds__040_ - in - Sexplib0.Sexp.List bnds__040_ - : t -> Sexplib0.Sexp.t) - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Mutable_record = struct - type t = - { mutable a : int - ; mutable b : int - ; mutable c : int - } - [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - - let t_of_sexp = - (let error_source__064_ = "expansion.ml.Mutable_record.t" in - function - | Sexplib0.Sexp.List field_sexps__049_ as sexp__048_ -> - let a__050_ = Stdlib.ref Stdlib.Option.None - and b__052_ = Stdlib.ref Stdlib.Option.None - and c__054_ = Stdlib.ref Stdlib.Option.None - and duplicates__056_ = Stdlib.ref [] - and extra__057_ = Stdlib.ref [] in - let rec iter__065_ = function - | Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom field_name__058_ :: (([] | [ _ ]) as _field_sexps__060_)) - :: tail__066_ -> - let _field_sexp__059_ () = - match _field_sexps__060_ with - | [ x__067_ ] -> x__067_ - | [] -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__064_ - sexp__048_ - | _ -> assert false - in - (match field_name__058_ with - | "a" -> - (match Stdlib.( ! ) a__050_ with - | Stdlib.Option.None -> - let _field_sexp__059_ = _field_sexp__059_ () in - let fvalue__063_ = int_of_sexp _field_sexp__059_ in - Stdlib.( := ) a__050_ (Stdlib.Option.Some fvalue__063_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__056_ - (field_name__058_ :: Stdlib.( ! ) duplicates__056_)) - | "b" -> - (match Stdlib.( ! ) b__052_ with - | Stdlib.Option.None -> - let _field_sexp__059_ = _field_sexp__059_ () in - let fvalue__062_ = int_of_sexp _field_sexp__059_ in - Stdlib.( := ) b__052_ (Stdlib.Option.Some fvalue__062_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__056_ - (field_name__058_ :: Stdlib.( ! ) duplicates__056_)) - | "c" -> - (match Stdlib.( ! ) c__054_ with - | Stdlib.Option.None -> - let _field_sexp__059_ = _field_sexp__059_ () in - let fvalue__061_ = int_of_sexp _field_sexp__059_ in - Stdlib.( := ) c__054_ (Stdlib.Option.Some fvalue__061_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__056_ - (field_name__058_ :: Stdlib.( ! ) duplicates__056_)) - | _ -> - if Stdlib.( ! ) Sexplib0.Sexp_conv.record_check_extra_fields - then Stdlib.( := ) extra__057_ (field_name__058_ :: Stdlib.( ! ) extra__057_) - else ()); - iter__065_ tail__066_ - | ((Sexplib0.Sexp.Atom _ | Sexplib0.Sexp.List _) as sexp__048_) :: _ -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__064_ - sexp__048_ - | [] -> () - in - iter__065_ field_sexps__049_; - (match Stdlib.( ! ) duplicates__056_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_duplicate_fields - error_source__064_ - (Stdlib.( ! ) duplicates__056_) - sexp__048_ - | [] -> - (match Stdlib.( ! ) extra__057_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_extra_fields - error_source__064_ - (Stdlib.( ! ) extra__057_) - sexp__048_ - | [] -> - (match Stdlib.( ! ) a__050_, Stdlib.( ! ) b__052_, Stdlib.( ! ) c__054_ with - | ( Stdlib.Option.Some a__051_ - , Stdlib.Option.Some b__053_ - , Stdlib.Option.Some c__055_ ) -> { a = a__051_; b = b__053_; c = c__055_ } - | _ -> - Sexplib0.Sexp_conv_error.record_undefined_elements - error_source__064_ - sexp__048_ - [ Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) a__050_) Stdlib.Option.None, "a" - ; Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) b__052_) Stdlib.Option.None, "b" - ; Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) c__054_) Stdlib.Option.None, "c" - ]))) - | Sexplib0.Sexp.Atom _ as sexp__048_ -> - Sexplib0.Sexp_conv_error.record_list_instead_atom error_source__064_ sexp__048_ - : Sexplib0.Sexp.t -> t) - ;; - - let _ = t_of_sexp - - let sexp_of_t = - (fun { a = a__069_; b = b__071_; c = c__073_ } -> - let bnds__068_ = [] in - let bnds__068_ = - let arg__074_ = sexp_of_int c__073_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "c"; arg__074_ ] :: bnds__068_ - in - let bnds__068_ = - let arg__072_ = sexp_of_int b__071_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "b"; arg__072_ ] :: bnds__068_ - in - let bnds__068_ = - let arg__070_ = sexp_of_int a__069_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "a"; arg__070_ ] :: bnds__068_ - in - Sexplib0.Sexp.List bnds__068_ - : t -> Sexplib0.Sexp.t) - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Variant = struct - type t = - | A - | B of int * int - | C of - { a : int - ; b : int - ; d : int - } - | D of - { mutable a : int - ; mutable b : int - ; mutable t : int - } - [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - - let t_of_sexp = - (let error_source__077_ = "expansion.ml.Variant.t" in - function - | Sexplib0.Sexp.Atom ("a" | "A") -> A - | Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom (("b" | "B") as _tag__080_) :: sexp_args__081_) as - _sexp__079_ -> - (match sexp_args__081_ with - | [ arg0__082_; arg1__083_ ] -> - let res0__084_ = int_of_sexp arg0__082_ - and res1__085_ = int_of_sexp arg1__083_ in - B (res0__084_, res1__085_) - | _ -> - Sexplib0.Sexp_conv_error.stag_incorrect_n_args - error_source__077_ - _tag__080_ - _sexp__079_) - | Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom (("c" | "C") as _tag__088_) :: field_sexps__086_) as - sexp__087_ -> - let a__089_ = Stdlib.ref Stdlib.Option.None - and b__091_ = Stdlib.ref Stdlib.Option.None - and d__093_ = Stdlib.ref Stdlib.Option.None - and duplicates__095_ = Stdlib.ref [] - and extra__096_ = Stdlib.ref [] in - let rec iter__103_ = function - | Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom field_name__097_ :: (([] | [ _ ]) as _field_sexps__099_)) - :: tail__104_ -> - let _field_sexp__098_ () = - match _field_sexps__099_ with - | [ x__105_ ] -> x__105_ - | [] -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__077_ - sexp__087_ - | _ -> assert false - in - (match field_name__097_ with - | "a" -> - (match Stdlib.( ! ) a__089_ with - | Stdlib.Option.None -> - let _field_sexp__098_ = _field_sexp__098_ () in - let fvalue__102_ = int_of_sexp _field_sexp__098_ in - Stdlib.( := ) a__089_ (Stdlib.Option.Some fvalue__102_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__095_ - (field_name__097_ :: Stdlib.( ! ) duplicates__095_)) - | "b" -> - (match Stdlib.( ! ) b__091_ with - | Stdlib.Option.None -> - let _field_sexp__098_ = _field_sexp__098_ () in - let fvalue__101_ = int_of_sexp _field_sexp__098_ in - Stdlib.( := ) b__091_ (Stdlib.Option.Some fvalue__101_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__095_ - (field_name__097_ :: Stdlib.( ! ) duplicates__095_)) - | "d" -> - (match Stdlib.( ! ) d__093_ with - | Stdlib.Option.None -> - let _field_sexp__098_ = _field_sexp__098_ () in - let fvalue__100_ = int_of_sexp _field_sexp__098_ in - Stdlib.( := ) d__093_ (Stdlib.Option.Some fvalue__100_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__095_ - (field_name__097_ :: Stdlib.( ! ) duplicates__095_)) - | _ -> - if Stdlib.( ! ) Sexplib0.Sexp_conv.record_check_extra_fields - then Stdlib.( := ) extra__096_ (field_name__097_ :: Stdlib.( ! ) extra__096_) - else ()); - iter__103_ tail__104_ - | ((Sexplib0.Sexp.Atom _ | Sexplib0.Sexp.List _) as sexp__087_) :: _ -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__077_ - sexp__087_ - | [] -> () - in - iter__103_ field_sexps__086_; - (match Stdlib.( ! ) duplicates__095_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_duplicate_fields - error_source__077_ - (Stdlib.( ! ) duplicates__095_) - sexp__087_ - | [] -> - (match Stdlib.( ! ) extra__096_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_extra_fields - error_source__077_ - (Stdlib.( ! ) extra__096_) - sexp__087_ - | [] -> - (match Stdlib.( ! ) a__089_, Stdlib.( ! ) b__091_, Stdlib.( ! ) d__093_ with - | ( Stdlib.Option.Some a__090_ - , Stdlib.Option.Some b__092_ - , Stdlib.Option.Some d__094_ ) -> C { a = a__090_; b = b__092_; d = d__094_ } - | _ -> - Sexplib0.Sexp_conv_error.record_undefined_elements - error_source__077_ - sexp__087_ - [ Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) a__089_) Stdlib.Option.None, "a" - ; Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) b__091_) Stdlib.Option.None, "b" - ; Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) d__093_) Stdlib.Option.None, "d" - ]))) - | Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom (("d" | "D") as _tag__108_) :: field_sexps__106_) as - sexp__107_ -> - let a__109_ = Stdlib.ref Stdlib.Option.None - and b__111_ = Stdlib.ref Stdlib.Option.None - and t__113_ = Stdlib.ref Stdlib.Option.None - and duplicates__115_ = Stdlib.ref [] - and extra__116_ = Stdlib.ref [] in - let rec iter__123_ = function - | Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom field_name__117_ :: (([] | [ _ ]) as _field_sexps__119_)) - :: tail__124_ -> - let _field_sexp__118_ () = - match _field_sexps__119_ with - | [ x__125_ ] -> x__125_ - | [] -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__077_ - sexp__107_ - | _ -> assert false - in - (match field_name__117_ with - | "a" -> - (match Stdlib.( ! ) a__109_ with - | Stdlib.Option.None -> - let _field_sexp__118_ = _field_sexp__118_ () in - let fvalue__122_ = int_of_sexp _field_sexp__118_ in - Stdlib.( := ) a__109_ (Stdlib.Option.Some fvalue__122_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__115_ - (field_name__117_ :: Stdlib.( ! ) duplicates__115_)) - | "b" -> - (match Stdlib.( ! ) b__111_ with - | Stdlib.Option.None -> - let _field_sexp__118_ = _field_sexp__118_ () in - let fvalue__121_ = int_of_sexp _field_sexp__118_ in - Stdlib.( := ) b__111_ (Stdlib.Option.Some fvalue__121_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__115_ - (field_name__117_ :: Stdlib.( ! ) duplicates__115_)) - | "t" -> - (match Stdlib.( ! ) t__113_ with - | Stdlib.Option.None -> - let _field_sexp__118_ = _field_sexp__118_ () in - let fvalue__120_ = int_of_sexp _field_sexp__118_ in - Stdlib.( := ) t__113_ (Stdlib.Option.Some fvalue__120_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__115_ - (field_name__117_ :: Stdlib.( ! ) duplicates__115_)) - | _ -> - if Stdlib.( ! ) Sexplib0.Sexp_conv.record_check_extra_fields - then Stdlib.( := ) extra__116_ (field_name__117_ :: Stdlib.( ! ) extra__116_) - else ()); - iter__123_ tail__124_ - | ((Sexplib0.Sexp.Atom _ | Sexplib0.Sexp.List _) as sexp__107_) :: _ -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__077_ - sexp__107_ - | [] -> () - in - iter__123_ field_sexps__106_; - (match Stdlib.( ! ) duplicates__115_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_duplicate_fields - error_source__077_ - (Stdlib.( ! ) duplicates__115_) - sexp__107_ - | [] -> - (match Stdlib.( ! ) extra__116_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_extra_fields - error_source__077_ - (Stdlib.( ! ) extra__116_) - sexp__107_ - | [] -> - (match Stdlib.( ! ) a__109_, Stdlib.( ! ) b__111_, Stdlib.( ! ) t__113_ with - | ( Stdlib.Option.Some a__110_ - , Stdlib.Option.Some b__112_ - , Stdlib.Option.Some t__114_ ) -> D { a = a__110_; b = b__112_; t = t__114_ } - | _ -> - Sexplib0.Sexp_conv_error.record_undefined_elements - error_source__077_ - sexp__107_ - [ Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) a__109_) Stdlib.Option.None, "a" - ; Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) b__111_) Stdlib.Option.None, "b" - ; Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) t__113_) Stdlib.Option.None, "t" - ]))) - | Sexplib0.Sexp.List (Sexplib0.Sexp.Atom ("a" | "A") :: _) as sexp__078_ -> - Sexplib0.Sexp_conv_error.stag_no_args error_source__077_ sexp__078_ - | Sexplib0.Sexp.Atom ("b" | "B") as sexp__078_ -> - Sexplib0.Sexp_conv_error.stag_takes_args error_source__077_ sexp__078_ - | Sexplib0.Sexp.Atom ("c" | "C") as sexp__078_ -> - Sexplib0.Sexp_conv_error.stag_takes_args error_source__077_ sexp__078_ - | Sexplib0.Sexp.Atom ("d" | "D") as sexp__078_ -> - Sexplib0.Sexp_conv_error.stag_takes_args error_source__077_ sexp__078_ - | Sexplib0.Sexp.List (Sexplib0.Sexp.List _ :: _) as sexp__076_ -> - Sexplib0.Sexp_conv_error.nested_list_invalid_sum error_source__077_ sexp__076_ - | Sexplib0.Sexp.List [] as sexp__076_ -> - Sexplib0.Sexp_conv_error.empty_list_invalid_sum error_source__077_ sexp__076_ - | sexp__076_ -> - Sexplib0.Sexp_conv_error.unexpected_stag error_source__077_ sexp__076_ - : Sexplib0.Sexp.t -> t) - ;; - - let _ = t_of_sexp - - let sexp_of_t = - (function - | A -> Sexplib0.Sexp.Atom "A" - | B (arg0__126_, arg1__127_) -> - let res0__128_ = sexp_of_int arg0__126_ - and res1__129_ = sexp_of_int arg1__127_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "B"; res0__128_; res1__129_ ] - | C { a = a__131_; b = b__133_; d = d__135_ } -> - let bnds__130_ = [] in - let bnds__130_ = - let arg__136_ = sexp_of_int d__135_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "d"; arg__136_ ] :: bnds__130_ - in - let bnds__130_ = - let arg__134_ = sexp_of_int b__133_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "b"; arg__134_ ] :: bnds__130_ - in - let bnds__130_ = - let arg__132_ = sexp_of_int a__131_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "a"; arg__132_ ] :: bnds__130_ - in - Sexplib0.Sexp.List (Sexplib0.Sexp.Atom "C" :: bnds__130_) - | D { a = a__138_; b = b__140_; t = t__142_ } -> - let bnds__137_ = [] in - let bnds__137_ = - let arg__143_ = sexp_of_int t__142_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "t"; arg__143_ ] :: bnds__137_ - in - let bnds__137_ = - let arg__141_ = sexp_of_int b__140_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "b"; arg__141_ ] :: bnds__137_ - in - let bnds__137_ = - let arg__139_ = sexp_of_int a__138_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "a"; arg__139_ ] :: bnds__137_ - in - Sexplib0.Sexp.List (Sexplib0.Sexp.Atom "D" :: bnds__137_) - : t -> Sexplib0.Sexp.t) - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Poly_variant = struct - type t = - [ `A - | `B of int - ] - [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - - let __t_of_sexp__ = - (let error_source__149_ = "expansion.ml.Poly_variant.t" in - function - | Sexplib0.Sexp.Atom atom__145_ as _sexp__147_ -> - (match atom__145_ with - | "A" -> `A - | "B" -> Sexplib0.Sexp_conv_error.ptag_takes_args error_source__149_ _sexp__147_ - | _ -> Sexplib0.Sexp_conv_error.no_variant_match ()) - | Sexplib0.Sexp.List (Sexplib0.Sexp.Atom atom__145_ :: sexp_args__148_) as - _sexp__147_ -> - (match atom__145_ with - | "B" as _tag__150_ -> - (match sexp_args__148_ with - | [ arg0__151_ ] -> - let res0__152_ = int_of_sexp arg0__151_ in - `B res0__152_ - | _ -> - Sexplib0.Sexp_conv_error.ptag_incorrect_n_args - error_source__149_ - _tag__150_ - _sexp__147_) - | "A" -> Sexplib0.Sexp_conv_error.ptag_no_args error_source__149_ _sexp__147_ - | _ -> Sexplib0.Sexp_conv_error.no_variant_match ()) - | Sexplib0.Sexp.List (Sexplib0.Sexp.List _ :: _) as sexp__146_ -> - Sexplib0.Sexp_conv_error.nested_list_invalid_poly_var error_source__149_ sexp__146_ - | Sexplib0.Sexp.List [] as sexp__146_ -> - Sexplib0.Sexp_conv_error.empty_list_invalid_poly_var error_source__149_ sexp__146_ - : Sexplib0.Sexp.t -> t) - ;; - - let _ = __t_of_sexp__ - - let t_of_sexp = - (let error_source__154_ = "expansion.ml.Poly_variant.t" in - fun sexp__153_ -> - try __t_of_sexp__ sexp__153_ with - | Sexplib0.Sexp_conv_error.No_variant_match -> - Sexplib0.Sexp_conv_error.no_matching_variant_found error_source__154_ sexp__153_ - : Sexplib0.Sexp.t -> t) - ;; - - let _ = t_of_sexp - - let sexp_of_t = - (function - | `A -> Sexplib0.Sexp.Atom "A" - | `B v__155_ -> Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "B"; sexp_of_int v__155_ ] - : t -> Sexplib0.Sexp.t) - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Inline_poly_variant = struct - type t = - [ Poly_variant.t - | `C of int * int - ] - [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - - let __t_of_sexp__ = - (let error_source__167_ = "expansion.ml.Inline_poly_variant.t" in - fun sexp__156_ -> - try (Poly_variant.__t_of_sexp__ sexp__156_ :> t) with - | Sexplib0.Sexp_conv_error.No_variant_match -> - (match sexp__156_ with - | Sexplib0.Sexp.Atom atom__157_ as _sexp__159_ -> - (match atom__157_ with - | "C" -> - Sexplib0.Sexp_conv_error.ptag_takes_args error_source__167_ _sexp__159_ - | _ -> Sexplib0.Sexp_conv_error.no_variant_match ()) - | Sexplib0.Sexp.List (Sexplib0.Sexp.Atom atom__157_ :: sexp_args__160_) as - _sexp__159_ -> - (match atom__157_ with - | "C" as _tag__161_ -> - (match sexp_args__160_ with - | [ arg0__168_ ] -> - let res0__169_ = - match arg0__168_ with - | Sexplib0.Sexp.List [ arg0__162_; arg1__163_ ] -> - let res0__164_ = int_of_sexp arg0__162_ - and res1__165_ = int_of_sexp arg1__163_ in - res0__164_, res1__165_ - | sexp__166_ -> - Sexplib0.Sexp_conv_error.tuple_of_size_n_expected - error_source__167_ - 2 - sexp__166_ - in - `C res0__169_ - | _ -> - Sexplib0.Sexp_conv_error.ptag_incorrect_n_args - error_source__167_ - _tag__161_ - _sexp__159_) - | _ -> Sexplib0.Sexp_conv_error.no_variant_match ()) - | Sexplib0.Sexp.List (Sexplib0.Sexp.List _ :: _) as sexp__158_ -> - Sexplib0.Sexp_conv_error.nested_list_invalid_poly_var - error_source__167_ - sexp__158_ - | Sexplib0.Sexp.List [] as sexp__158_ -> - Sexplib0.Sexp_conv_error.empty_list_invalid_poly_var - error_source__167_ - sexp__158_) - : Sexplib0.Sexp.t -> t) - ;; - - let _ = __t_of_sexp__ - - let t_of_sexp = - (let error_source__171_ = "expansion.ml.Inline_poly_variant.t" in - fun sexp__170_ -> - try __t_of_sexp__ sexp__170_ with - | Sexplib0.Sexp_conv_error.No_variant_match -> - Sexplib0.Sexp_conv_error.no_matching_variant_found error_source__171_ sexp__170_ - : Sexplib0.Sexp.t -> t) - ;; - - let _ = t_of_sexp - - let sexp_of_t = - (function - | #Poly_variant.t as v__172_ -> Poly_variant.sexp_of_t v__172_ - | `C v__173_ -> - Sexplib0.Sexp.List - [ Sexplib0.Sexp.Atom "C" - ; (let arg0__174_, arg1__175_ = v__173_ in - let res0__176_ = sexp_of_int arg0__174_ - and res1__177_ = sexp_of_int arg1__175_ in - Sexplib0.Sexp.List [ res0__176_; res1__177_ ]) - ] - : t -> Sexplib0.Sexp.t) - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Recursive = struct - type t = - | Banana of t - | Orange - [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - - let rec t_of_sexp = - (let error_source__180_ = "expansion.ml.Recursive.t" in - function - | Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom (("banana" | "Banana") as _tag__183_) :: sexp_args__184_) as - _sexp__182_ -> - (match sexp_args__184_ with - | [ arg0__185_ ] -> - let res0__186_ = t_of_sexp arg0__185_ in - Banana res0__186_ - | _ -> - Sexplib0.Sexp_conv_error.stag_incorrect_n_args - error_source__180_ - _tag__183_ - _sexp__182_) - | Sexplib0.Sexp.Atom ("orange" | "Orange") -> Orange - | Sexplib0.Sexp.Atom ("banana" | "Banana") as sexp__181_ -> - Sexplib0.Sexp_conv_error.stag_takes_args error_source__180_ sexp__181_ - | Sexplib0.Sexp.List (Sexplib0.Sexp.Atom ("orange" | "Orange") :: _) as sexp__181_ -> - Sexplib0.Sexp_conv_error.stag_no_args error_source__180_ sexp__181_ - | Sexplib0.Sexp.List (Sexplib0.Sexp.List _ :: _) as sexp__179_ -> - Sexplib0.Sexp_conv_error.nested_list_invalid_sum error_source__180_ sexp__179_ - | Sexplib0.Sexp.List [] as sexp__179_ -> - Sexplib0.Sexp_conv_error.empty_list_invalid_sum error_source__180_ sexp__179_ - | sexp__179_ -> - Sexplib0.Sexp_conv_error.unexpected_stag error_source__180_ sexp__179_ - : Sexplib0.Sexp.t -> t) - ;; - - let _ = t_of_sexp - - let rec sexp_of_t = - (function - | Banana arg0__187_ -> - let res0__188_ = sexp_of_t arg0__187_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "Banana"; res0__188_ ] - | Orange -> Sexplib0.Sexp.Atom "Orange" - : t -> Sexplib0.Sexp.t) - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Nonrecursive = struct - open Recursive - - type nonrec t = t [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - let t_of_sexp = (t_of_sexp : Sexplib0.Sexp.t -> t) - let _ = t_of_sexp - let sexp_of_t = (sexp_of_t : t -> Sexplib0.Sexp.t) - let _ = sexp_of_t - - [@@@end] -end - -module Mutually_recursive = struct - type a = - | A - | B of b - | C of - { a : a - ; b : b - ; c : c - } - - and b = - { a : a - ; b : b - } - - and c = int [@@deriving_inline sexp] - - let _ = fun (_ : a) -> () - let _ = fun (_ : b) -> () - let _ = fun (_ : c) -> () - - let rec a_of_sexp = - (let error_source__192_ = "expansion.ml.Mutually_recursive.a" in - function - | Sexplib0.Sexp.Atom ("a" | "A") -> A - | Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom (("b" | "B") as _tag__195_) :: sexp_args__196_) as - _sexp__194_ -> - (match sexp_args__196_ with - | [ arg0__197_ ] -> - let res0__198_ = b_of_sexp arg0__197_ in - B res0__198_ - | _ -> - Sexplib0.Sexp_conv_error.stag_incorrect_n_args - error_source__192_ - _tag__195_ - _sexp__194_) - | Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom (("c" | "C") as _tag__201_) :: field_sexps__199_) as - sexp__200_ -> - let a__202_ = Stdlib.ref Stdlib.Option.None - and b__204_ = Stdlib.ref Stdlib.Option.None - and c__206_ = Stdlib.ref Stdlib.Option.None - and duplicates__208_ = Stdlib.ref [] - and extra__209_ = Stdlib.ref [] in - let rec iter__216_ = function - | Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom field_name__210_ :: (([] | [ _ ]) as _field_sexps__212_)) - :: tail__217_ -> - let _field_sexp__211_ () = - match _field_sexps__212_ with - | [ x__218_ ] -> x__218_ - | [] -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__192_ - sexp__200_ - | _ -> assert false - in - (match field_name__210_ with - | "a" -> - (match Stdlib.( ! ) a__202_ with - | Stdlib.Option.None -> - let _field_sexp__211_ = _field_sexp__211_ () in - let fvalue__215_ = a_of_sexp _field_sexp__211_ in - Stdlib.( := ) a__202_ (Stdlib.Option.Some fvalue__215_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__208_ - (field_name__210_ :: Stdlib.( ! ) duplicates__208_)) - | "b" -> - (match Stdlib.( ! ) b__204_ with - | Stdlib.Option.None -> - let _field_sexp__211_ = _field_sexp__211_ () in - let fvalue__214_ = b_of_sexp _field_sexp__211_ in - Stdlib.( := ) b__204_ (Stdlib.Option.Some fvalue__214_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__208_ - (field_name__210_ :: Stdlib.( ! ) duplicates__208_)) - | "c" -> - (match Stdlib.( ! ) c__206_ with - | Stdlib.Option.None -> - let _field_sexp__211_ = _field_sexp__211_ () in - let fvalue__213_ = c_of_sexp _field_sexp__211_ in - Stdlib.( := ) c__206_ (Stdlib.Option.Some fvalue__213_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__208_ - (field_name__210_ :: Stdlib.( ! ) duplicates__208_)) - | _ -> - if Stdlib.( ! ) Sexplib0.Sexp_conv.record_check_extra_fields - then Stdlib.( := ) extra__209_ (field_name__210_ :: Stdlib.( ! ) extra__209_) - else ()); - iter__216_ tail__217_ - | ((Sexplib0.Sexp.Atom _ | Sexplib0.Sexp.List _) as sexp__200_) :: _ -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__192_ - sexp__200_ - | [] -> () - in - iter__216_ field_sexps__199_; - (match Stdlib.( ! ) duplicates__208_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_duplicate_fields - error_source__192_ - (Stdlib.( ! ) duplicates__208_) - sexp__200_ - | [] -> - (match Stdlib.( ! ) extra__209_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_extra_fields - error_source__192_ - (Stdlib.( ! ) extra__209_) - sexp__200_ - | [] -> - (match Stdlib.( ! ) a__202_, Stdlib.( ! ) b__204_, Stdlib.( ! ) c__206_ with - | ( Stdlib.Option.Some a__203_ - , Stdlib.Option.Some b__205_ - , Stdlib.Option.Some c__207_ ) -> C { a = a__203_; b = b__205_; c = c__207_ } - | _ -> - Sexplib0.Sexp_conv_error.record_undefined_elements - error_source__192_ - sexp__200_ - [ Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) a__202_) Stdlib.Option.None, "a" - ; Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) b__204_) Stdlib.Option.None, "b" - ; Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) c__206_) Stdlib.Option.None, "c" - ]))) - | Sexplib0.Sexp.List (Sexplib0.Sexp.Atom ("a" | "A") :: _) as sexp__193_ -> - Sexplib0.Sexp_conv_error.stag_no_args error_source__192_ sexp__193_ - | Sexplib0.Sexp.Atom ("b" | "B") as sexp__193_ -> - Sexplib0.Sexp_conv_error.stag_takes_args error_source__192_ sexp__193_ - | Sexplib0.Sexp.Atom ("c" | "C") as sexp__193_ -> - Sexplib0.Sexp_conv_error.stag_takes_args error_source__192_ sexp__193_ - | Sexplib0.Sexp.List (Sexplib0.Sexp.List _ :: _) as sexp__191_ -> - Sexplib0.Sexp_conv_error.nested_list_invalid_sum error_source__192_ sexp__191_ - | Sexplib0.Sexp.List [] as sexp__191_ -> - Sexplib0.Sexp_conv_error.empty_list_invalid_sum error_source__192_ sexp__191_ - | sexp__191_ -> - Sexplib0.Sexp_conv_error.unexpected_stag error_source__192_ sexp__191_ - : Sexplib0.Sexp.t -> a) - - and b_of_sexp = - (let error_source__233_ = "expansion.ml.Mutually_recursive.b" in - function - | Sexplib0.Sexp.List field_sexps__221_ as sexp__220_ -> - let a__222_ = Stdlib.ref Stdlib.Option.None - and b__224_ = Stdlib.ref Stdlib.Option.None - and duplicates__226_ = Stdlib.ref [] - and extra__227_ = Stdlib.ref [] in - let rec iter__234_ = function - | Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom field_name__228_ :: (([] | [ _ ]) as _field_sexps__230_)) - :: tail__235_ -> - let _field_sexp__229_ () = - match _field_sexps__230_ with - | [ x__236_ ] -> x__236_ - | [] -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__233_ - sexp__220_ - | _ -> assert false - in - (match field_name__228_ with - | "a" -> - (match Stdlib.( ! ) a__222_ with - | Stdlib.Option.None -> - let _field_sexp__229_ = _field_sexp__229_ () in - let fvalue__232_ = a_of_sexp _field_sexp__229_ in - Stdlib.( := ) a__222_ (Stdlib.Option.Some fvalue__232_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__226_ - (field_name__228_ :: Stdlib.( ! ) duplicates__226_)) - | "b" -> - (match Stdlib.( ! ) b__224_ with - | Stdlib.Option.None -> - let _field_sexp__229_ = _field_sexp__229_ () in - let fvalue__231_ = b_of_sexp _field_sexp__229_ in - Stdlib.( := ) b__224_ (Stdlib.Option.Some fvalue__231_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__226_ - (field_name__228_ :: Stdlib.( ! ) duplicates__226_)) - | _ -> - if Stdlib.( ! ) Sexplib0.Sexp_conv.record_check_extra_fields - then Stdlib.( := ) extra__227_ (field_name__228_ :: Stdlib.( ! ) extra__227_) - else ()); - iter__234_ tail__235_ - | ((Sexplib0.Sexp.Atom _ | Sexplib0.Sexp.List _) as sexp__220_) :: _ -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__233_ - sexp__220_ - | [] -> () - in - iter__234_ field_sexps__221_; - (match Stdlib.( ! ) duplicates__226_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_duplicate_fields - error_source__233_ - (Stdlib.( ! ) duplicates__226_) - sexp__220_ - | [] -> - (match Stdlib.( ! ) extra__227_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_extra_fields - error_source__233_ - (Stdlib.( ! ) extra__227_) - sexp__220_ - | [] -> - (match Stdlib.( ! ) a__222_, Stdlib.( ! ) b__224_ with - | Stdlib.Option.Some a__223_, Stdlib.Option.Some b__225_ -> - { a = a__223_; b = b__225_ } - | _ -> - Sexplib0.Sexp_conv_error.record_undefined_elements - error_source__233_ - sexp__220_ - [ Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) a__222_) Stdlib.Option.None, "a" - ; Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) b__224_) Stdlib.Option.None, "b" - ]))) - | Sexplib0.Sexp.Atom _ as sexp__220_ -> - Sexplib0.Sexp_conv_error.record_list_instead_atom error_source__233_ sexp__220_ - : Sexplib0.Sexp.t -> b) - - and c_of_sexp = (int_of_sexp : Sexplib0.Sexp.t -> c) - - let _ = a_of_sexp - and _ = b_of_sexp - and _ = c_of_sexp - - let rec sexp_of_a = - (function - | A -> Sexplib0.Sexp.Atom "A" - | B arg0__238_ -> - let res0__239_ = sexp_of_b arg0__238_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "B"; res0__239_ ] - | C { a = a__241_; b = b__243_; c = c__245_ } -> - let bnds__240_ = [] in - let bnds__240_ = - let arg__246_ = sexp_of_c c__245_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "c"; arg__246_ ] :: bnds__240_ - in - let bnds__240_ = - let arg__244_ = sexp_of_b b__243_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "b"; arg__244_ ] :: bnds__240_ - in - let bnds__240_ = - let arg__242_ = sexp_of_a a__241_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "a"; arg__242_ ] :: bnds__240_ - in - Sexplib0.Sexp.List (Sexplib0.Sexp.Atom "C" :: bnds__240_) - : a -> Sexplib0.Sexp.t) - - and sexp_of_b = - (fun { a = a__248_; b = b__250_ } -> - let bnds__247_ = [] in - let bnds__247_ = - let arg__251_ = sexp_of_b b__250_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "b"; arg__251_ ] :: bnds__247_ - in - let bnds__247_ = - let arg__249_ = sexp_of_a a__248_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "a"; arg__249_ ] :: bnds__247_ - in - Sexplib0.Sexp.List bnds__247_ - : b -> Sexplib0.Sexp.t) - - and sexp_of_c = (sexp_of_int : c -> Sexplib0.Sexp.t) - - let _ = sexp_of_a - and _ = sexp_of_b - and _ = sexp_of_c - - [@@@end] -end - -module Alias = struct - type t = Recursive.t [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - let t_of_sexp = (Recursive.t_of_sexp : Sexplib0.Sexp.t -> t) - let _ = t_of_sexp - let sexp_of_t = (Recursive.sexp_of_t : t -> Sexplib0.Sexp.t) - let _ = sexp_of_t - - [@@@end] -end - -module Re_export = struct - type t = Recursive.t = - | Banana of t - | Orange - [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - - let rec t_of_sexp = - (let error_source__255_ = "expansion.ml.Re_export.t" in - function - | Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom (("banana" | "Banana") as _tag__258_) :: sexp_args__259_) as - _sexp__257_ -> - (match sexp_args__259_ with - | [ arg0__260_ ] -> - let res0__261_ = t_of_sexp arg0__260_ in - Banana res0__261_ - | _ -> - Sexplib0.Sexp_conv_error.stag_incorrect_n_args - error_source__255_ - _tag__258_ - _sexp__257_) - | Sexplib0.Sexp.Atom ("orange" | "Orange") -> Orange - | Sexplib0.Sexp.Atom ("banana" | "Banana") as sexp__256_ -> - Sexplib0.Sexp_conv_error.stag_takes_args error_source__255_ sexp__256_ - | Sexplib0.Sexp.List (Sexplib0.Sexp.Atom ("orange" | "Orange") :: _) as sexp__256_ -> - Sexplib0.Sexp_conv_error.stag_no_args error_source__255_ sexp__256_ - | Sexplib0.Sexp.List (Sexplib0.Sexp.List _ :: _) as sexp__254_ -> - Sexplib0.Sexp_conv_error.nested_list_invalid_sum error_source__255_ sexp__254_ - | Sexplib0.Sexp.List [] as sexp__254_ -> - Sexplib0.Sexp_conv_error.empty_list_invalid_sum error_source__255_ sexp__254_ - | sexp__254_ -> - Sexplib0.Sexp_conv_error.unexpected_stag error_source__255_ sexp__254_ - : Sexplib0.Sexp.t -> t) - ;; - - let _ = t_of_sexp - - let rec sexp_of_t = - (function - | Banana arg0__262_ -> - let res0__263_ = sexp_of_t arg0__262_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "Banana"; res0__263_ ] - | Orange -> Sexplib0.Sexp.Atom "Orange" - : t -> Sexplib0.Sexp.t) - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Unary = struct - type 'a t = 'a list option [@@deriving_inline sexp] - - let _ = fun (_ : 'a t) -> () - - let t_of_sexp : 'a. (Sexplib0.Sexp.t -> 'a) -> Sexplib0.Sexp.t -> 'a t = - fun _of_a__264_ x__266_ -> option_of_sexp (list_of_sexp _of_a__264_) x__266_ - ;; - - let _ = t_of_sexp - - let sexp_of_t : 'a. ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t = - fun _of_a__267_ x__268_ -> sexp_of_option (sexp_of_list _of_a__267_) x__268_ - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Binary = struct - type ('a, 'b) t = ('a, 'b) Either.t [@@deriving_inline sexp] - - let _ = fun (_ : ('a, 'b) t) -> () - - let t_of_sexp : - 'a 'b. - (Sexplib0.Sexp.t -> 'a) - -> (Sexplib0.Sexp.t -> 'b) - -> Sexplib0.Sexp.t - -> ('a, 'b) t - = - Either.t_of_sexp - ;; - - let _ = t_of_sexp - - let sexp_of_t : - 'a 'b. - ('a -> Sexplib0.Sexp.t) - -> ('b -> Sexplib0.Sexp.t) - -> ('a, 'b) t - -> Sexplib0.Sexp.t - = - Either.sexp_of_t - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module First_order = struct - type 'a t = 'a -> 'a [@@deriving_inline sexp] - - let _ = fun (_ : 'a t) -> () - - let t_of_sexp : 'a. (Sexplib0.Sexp.t -> 'a) -> Sexplib0.Sexp.t -> 'a t = - fun _of_a__276_ -> Sexplib0.Sexp_conv.fun_of_sexp - ;; - - let _ = t_of_sexp - - let sexp_of_t : 'a. ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t = - fun _of_a__278_ _ -> Sexplib0.Sexp_conv.sexp_of_fun Sexplib0.Sexp_conv.ignore - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Second_order = struct - type ('a, 'b) t = ('a -> 'a) -> ('a -> 'b) -> ('b -> 'b) -> 'a -> 'b - [@@deriving_inline sexp] - - let _ = fun (_ : ('a, 'b) t) -> () - - let t_of_sexp : - 'a 'b. - (Sexplib0.Sexp.t -> 'a) - -> (Sexplib0.Sexp.t -> 'b) - -> Sexplib0.Sexp.t - -> ('a, 'b) t - = - fun _of_a__279_ _of_b__280_ -> Sexplib0.Sexp_conv.fun_of_sexp - ;; - - let _ = t_of_sexp - - let sexp_of_t : - 'a 'b. - ('a -> Sexplib0.Sexp.t) - -> ('b -> Sexplib0.Sexp.t) - -> ('a, 'b) t - -> Sexplib0.Sexp.t - = - fun _of_a__282_ _of_b__283_ _ -> - Sexplib0.Sexp_conv.sexp_of_fun Sexplib0.Sexp_conv.ignore - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Named_arguments = struct - type t = ?a:int -> b:int -> int -> int [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - let t_of_sexp = (Sexplib0.Sexp_conv.fun_of_sexp : Sexplib0.Sexp.t -> t) - let _ = t_of_sexp - - let sexp_of_t = - (fun _ -> Sexplib0.Sexp_conv.sexp_of_fun Sexplib0.Sexp_conv.ignore - : t -> Sexplib0.Sexp.t) - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Gadt = struct - type _ t = - | A : _ option t - | B : int -> int t - | C : 'a list -> unit t - [@@deriving_inline sexp_of] - - let _ = fun (_ : _ t) -> () - - let sexp_of_t : 'a__285_. ('a__285_ -> Sexplib0.Sexp.t) -> 'a__285_ t -> Sexplib0.Sexp.t - = - fun (type a__291_) : ((a__291_ -> Sexplib0.Sexp.t) -> a__291_ t -> Sexplib0.Sexp.t) -> - fun _of_a__286_ -> function - | A -> Sexplib0.Sexp.Atom "A" - | B arg0__287_ -> - let res0__288_ = sexp_of_int arg0__287_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "B"; res0__288_ ] - | C arg0__289_ -> - let res0__290_ = sexp_of_list (fun _ -> Sexplib0.Sexp.Atom "_") arg0__289_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "C"; res0__290_ ] - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Recursive_record_containing_variant = struct - type t = - { a : [ `A of t ] - ; b : [ `B ] [@sexp_drop_default Poly.equal] [@default `B] - } - [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - - let rec t_of_sexp = - (let (default__324_ : [ `B ]) = `B in - let error_source__310_ = "expansion.ml.Recursive_record_containing_variant.t" in - function - | Sexplib0.Sexp.List field_sexps__294_ as sexp__293_ -> - let a__295_ = Stdlib.ref Stdlib.Option.None - and b__297_ = Stdlib.ref Stdlib.Option.None - and duplicates__299_ = Stdlib.ref [] - and extra__300_ = Stdlib.ref [] in - let rec iter__326_ = function - | Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom field_name__301_ :: (([] | [ _ ]) as _field_sexps__303_)) - :: tail__327_ -> - let _field_sexp__302_ () = - match _field_sexps__303_ with - | [ x__328_ ] -> x__328_ - | [] -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__310_ - sexp__293_ - | _ -> assert false - in - (match field_name__301_ with - | "a" -> - (match Stdlib.( ! ) a__295_ with - | Stdlib.Option.None -> - let _field_sexp__302_ = _field_sexp__302_ () in - let fvalue__322_ = - let sexp__321_ = _field_sexp__302_ in - try - match sexp__321_ with - | Sexplib0.Sexp.Atom atom__314_ as _sexp__316_ -> - (match atom__314_ with - | "A" -> - Sexplib0.Sexp_conv_error.ptag_takes_args - error_source__310_ - _sexp__316_ - | _ -> Sexplib0.Sexp_conv_error.no_variant_match ()) - | Sexplib0.Sexp.List (Sexplib0.Sexp.Atom atom__314_ :: sexp_args__317_) - as _sexp__316_ -> - (match atom__314_ with - | "A" as _tag__318_ -> - (match sexp_args__317_ with - | [ arg0__319_ ] -> - let res0__320_ = t_of_sexp arg0__319_ in - `A res0__320_ - | _ -> - Sexplib0.Sexp_conv_error.ptag_incorrect_n_args - error_source__310_ - _tag__318_ - _sexp__316_) - | _ -> Sexplib0.Sexp_conv_error.no_variant_match ()) - | Sexplib0.Sexp.List (Sexplib0.Sexp.List _ :: _) as sexp__315_ -> - Sexplib0.Sexp_conv_error.nested_list_invalid_poly_var - error_source__310_ - sexp__315_ - | Sexplib0.Sexp.List [] as sexp__315_ -> - Sexplib0.Sexp_conv_error.empty_list_invalid_poly_var - error_source__310_ - sexp__315_ - with - | Sexplib0.Sexp_conv_error.No_variant_match -> - Sexplib0.Sexp_conv_error.no_matching_variant_found - error_source__310_ - sexp__321_ - in - Stdlib.( := ) a__295_ (Stdlib.Option.Some fvalue__322_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__299_ - (field_name__301_ :: Stdlib.( ! ) duplicates__299_)) - | "b" -> - (match Stdlib.( ! ) b__297_ with - | Stdlib.Option.None -> - let _field_sexp__302_ = _field_sexp__302_ () in - let fvalue__312_ = - let sexp__311_ = _field_sexp__302_ in - try - match sexp__311_ with - | Sexplib0.Sexp.Atom atom__306_ as _sexp__308_ -> - (match atom__306_ with - | "B" -> `B - | _ -> Sexplib0.Sexp_conv_error.no_variant_match ()) - | Sexplib0.Sexp.List (Sexplib0.Sexp.Atom atom__306_ :: _) as - _sexp__308_ -> - (match atom__306_ with - | "B" -> - Sexplib0.Sexp_conv_error.ptag_no_args - error_source__310_ - _sexp__308_ - | _ -> Sexplib0.Sexp_conv_error.no_variant_match ()) - | Sexplib0.Sexp.List (Sexplib0.Sexp.List _ :: _) as sexp__307_ -> - Sexplib0.Sexp_conv_error.nested_list_invalid_poly_var - error_source__310_ - sexp__307_ - | Sexplib0.Sexp.List [] as sexp__307_ -> - Sexplib0.Sexp_conv_error.empty_list_invalid_poly_var - error_source__310_ - sexp__307_ - with - | Sexplib0.Sexp_conv_error.No_variant_match -> - Sexplib0.Sexp_conv_error.no_matching_variant_found - error_source__310_ - sexp__311_ - in - Stdlib.( := ) b__297_ (Stdlib.Option.Some fvalue__312_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__299_ - (field_name__301_ :: Stdlib.( ! ) duplicates__299_)) - | _ -> - if Stdlib.( ! ) Sexplib0.Sexp_conv.record_check_extra_fields - then Stdlib.( := ) extra__300_ (field_name__301_ :: Stdlib.( ! ) extra__300_) - else ()); - iter__326_ tail__327_ - | ((Sexplib0.Sexp.Atom _ | Sexplib0.Sexp.List _) as sexp__293_) :: _ -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__310_ - sexp__293_ - | [] -> () - in - iter__326_ field_sexps__294_; - (match Stdlib.( ! ) duplicates__299_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_duplicate_fields - error_source__310_ - (Stdlib.( ! ) duplicates__299_) - sexp__293_ - | [] -> - (match Stdlib.( ! ) extra__300_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_extra_fields - error_source__310_ - (Stdlib.( ! ) extra__300_) - sexp__293_ - | [] -> - (match Stdlib.( ! ) a__295_, Stdlib.( ! ) b__297_ with - | Stdlib.Option.Some a__296_, b__298_ -> - { a = a__296_ - ; b = - (match b__298_ with - | Stdlib.Option.None -> default__324_ - | Stdlib.Option.Some v__325_ -> v__325_) - } - | _ -> - Sexplib0.Sexp_conv_error.record_undefined_elements - error_source__310_ - sexp__293_ - [ Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) a__295_) Stdlib.Option.None, "a" ]))) - | Sexplib0.Sexp.Atom _ as sexp__293_ -> - Sexplib0.Sexp_conv_error.record_list_instead_atom error_source__310_ sexp__293_ - : Sexplib0.Sexp.t -> t) - ;; - - let _ = t_of_sexp - - let rec sexp_of_t = - (let (default__335_ : [ `B ]) = `B - and (drop_default__334_ : [ `B ] -> [ `B ] -> Stdlib.Bool.t) = Poly.equal in - fun { a = a__330_; b = b__336_ } -> - let bnds__329_ = [] in - let bnds__329_ = - if drop_default__334_ default__335_ b__336_ - then bnds__329_ - else ( - let arg__338_ = (fun `B -> Sexplib0.Sexp.Atom "B") b__336_ in - let bnd__337_ = Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "b"; arg__338_ ] in - bnd__337_ :: bnds__329_) - in - let bnds__329_ = - let arg__331_ = - let (`A v__332_) = a__330_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "A"; sexp_of_t v__332_ ] - in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "a"; arg__331_ ] :: bnds__329_ - in - Sexplib0.Sexp.List bnds__329_ - : t -> Sexplib0.Sexp.t) - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Poly_record = struct - type t = - { a : 'a. 'a list - ; b : 'b. 'b option - ; c : 'c. 'c - } - [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - - let t_of_sexp = - (let error_source__355_ = "expansion.ml.Poly_record.t" in - function - | Sexplib0.Sexp.List field_sexps__341_ as sexp__340_ -> - let a__366_, b__367_, c__368_ = - let a__342_ = Stdlib.ref Stdlib.Option.None - and b__344_ = Stdlib.ref Stdlib.Option.None - and c__346_ = Stdlib.ref Stdlib.Option.None - and duplicates__348_ = Stdlib.ref [] - and extra__349_ = Stdlib.ref [] in - let rec iter__363_ = function - | Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom field_name__350_ - :: (([] | [ _ ]) as _field_sexps__352_)) - :: tail__364_ -> - let _field_sexp__351_ () = - match _field_sexps__352_ with - | [ x__365_ ] -> x__365_ - | [] -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__355_ - sexp__340_ - | _ -> assert false - in - (match field_name__350_ with - | "a" -> - (match Stdlib.( ! ) a__342_ with - | Stdlib.Option.None -> - let _field_sexp__351_ = _field_sexp__351_ () in - let fvalue__362_ = - let _of_a__360_ sexp__361_ = - Sexplib0.Sexp_conv_error.record_poly_field_value - error_source__355_ - sexp__361_ - in - list_of_sexp _of_a__360_ _field_sexp__351_ - in - Stdlib.( := ) a__342_ (Stdlib.Option.Some fvalue__362_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__348_ - (field_name__350_ :: Stdlib.( ! ) duplicates__348_)) - | "b" -> - (match Stdlib.( ! ) b__344_ with - | Stdlib.Option.None -> - let _field_sexp__351_ = _field_sexp__351_ () in - let fvalue__359_ = - let _of_b__357_ sexp__358_ = - Sexplib0.Sexp_conv_error.record_poly_field_value - error_source__355_ - sexp__358_ - in - option_of_sexp _of_b__357_ _field_sexp__351_ - in - Stdlib.( := ) b__344_ (Stdlib.Option.Some fvalue__359_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__348_ - (field_name__350_ :: Stdlib.( ! ) duplicates__348_)) - | "c" -> - (match Stdlib.( ! ) c__346_ with - | Stdlib.Option.None -> - let _field_sexp__351_ = _field_sexp__351_ () in - let fvalue__356_ = - let _of_c__353_ sexp__354_ = - Sexplib0.Sexp_conv_error.record_poly_field_value - error_source__355_ - sexp__354_ - in - _of_c__353_ _field_sexp__351_ - in - Stdlib.( := ) c__346_ (Stdlib.Option.Some fvalue__356_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__348_ - (field_name__350_ :: Stdlib.( ! ) duplicates__348_)) - | _ -> - if Stdlib.( ! ) Sexplib0.Sexp_conv.record_check_extra_fields - then - Stdlib.( := ) extra__349_ (field_name__350_ :: Stdlib.( ! ) extra__349_) - else ()); - iter__363_ tail__364_ - | ((Sexplib0.Sexp.Atom _ | Sexplib0.Sexp.List _) as sexp__340_) :: _ -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__355_ - sexp__340_ - | [] -> () - in - iter__363_ field_sexps__341_; - match Stdlib.( ! ) duplicates__348_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_duplicate_fields - error_source__355_ - (Stdlib.( ! ) duplicates__348_) - sexp__340_ - | [] -> - (match Stdlib.( ! ) extra__349_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_extra_fields - error_source__355_ - (Stdlib.( ! ) extra__349_) - sexp__340_ - | [] -> - (match Stdlib.( ! ) a__342_, Stdlib.( ! ) b__344_, Stdlib.( ! ) c__346_ with - | ( Stdlib.Option.Some a__343_ - , Stdlib.Option.Some b__345_ - , Stdlib.Option.Some c__347_ ) -> a__343_, b__345_, c__347_ - | _ -> - Sexplib0.Sexp_conv_error.record_undefined_elements - error_source__355_ - sexp__340_ - [ Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) a__342_) Stdlib.Option.None, "a" - ; Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) b__344_) Stdlib.Option.None, "b" - ; Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) c__346_) Stdlib.Option.None, "c" - ])) - in - { a = a__366_; b = b__367_; c = c__368_ } - | Sexplib0.Sexp.Atom _ as sexp__340_ -> - Sexplib0.Sexp_conv_error.record_list_instead_atom error_source__355_ sexp__340_ - : Sexplib0.Sexp.t -> t) - ;; - - let _ = t_of_sexp - - let sexp_of_t = - (fun { a = a__370_; b = b__373_; c = c__376_ } -> - let bnds__369_ = [] in - let bnds__369_ = - let arg__377_ = - let _of_c__378_ = Sexplib0.Sexp_conv.sexp_of_opaque in - _of_c__378_ c__376_ - in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "c"; arg__377_ ] :: bnds__369_ - in - let bnds__369_ = - let arg__374_ = - let _of_b__375_ = Sexplib0.Sexp_conv.sexp_of_opaque in - sexp_of_option _of_b__375_ b__373_ - in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "b"; arg__374_ ] :: bnds__369_ - in - let bnds__369_ = - let arg__371_ = - let _of_a__372_ = Sexplib0.Sexp_conv.sexp_of_opaque in - sexp_of_list _of_a__372_ a__370_ - in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "a"; arg__371_ ] :: bnds__369_ - in - Sexplib0.Sexp.List bnds__369_ - : t -> Sexplib0.Sexp.t) - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Record_with_defaults = struct - type t = - { a : int [@default 0] - ; b : int [@default 0] [@sexp_drop_default.compare] - ; c : int [@default 0] [@sexp_drop_default.equal] - ; d : int [@default 0] [@sexp_drop_default.sexp] - ; e : int [@default 0] [@sexp_drop_default ( = )] - ; f : int [@sexp_drop_if ( = ) 0] - } - [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - - let t_of_sexp = - (let (default__415_ : int) = 0 - and (default__417_ : int) = 0 - and (default__419_ : int) = 0 - and (default__421_ : int) = 0 - and (default__423_ : int) = 0 in - let error_source__425_ = "expansion.ml.Record_with_defaults.t" in - function - | Sexplib0.Sexp.List field_sexps__381_ as sexp__380_ -> - let a__382_ = Stdlib.ref Stdlib.Option.None - and b__384_ = Stdlib.ref Stdlib.Option.None - and c__386_ = Stdlib.ref Stdlib.Option.None - and d__388_ = Stdlib.ref Stdlib.Option.None - and e__390_ = Stdlib.ref Stdlib.Option.None - and f__392_ = Stdlib.ref Stdlib.Option.None - and duplicates__394_ = Stdlib.ref [] - and extra__395_ = Stdlib.ref [] in - let rec iter__426_ = function - | Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom field_name__396_ :: (([] | [ _ ]) as _field_sexps__398_)) - :: tail__427_ -> - let _field_sexp__397_ () = - match _field_sexps__398_ with - | [ x__428_ ] -> x__428_ - | [] -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__425_ - sexp__380_ - | _ -> assert false - in - (match field_name__396_ with - | "a" -> - (match Stdlib.( ! ) a__382_ with - | Stdlib.Option.None -> - let _field_sexp__397_ = _field_sexp__397_ () in - let fvalue__409_ = int_of_sexp _field_sexp__397_ in - Stdlib.( := ) a__382_ (Stdlib.Option.Some fvalue__409_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__394_ - (field_name__396_ :: Stdlib.( ! ) duplicates__394_)) - | "b" -> - (match Stdlib.( ! ) b__384_ with - | Stdlib.Option.None -> - let _field_sexp__397_ = _field_sexp__397_ () in - let fvalue__407_ = int_of_sexp _field_sexp__397_ in - Stdlib.( := ) b__384_ (Stdlib.Option.Some fvalue__407_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__394_ - (field_name__396_ :: Stdlib.( ! ) duplicates__394_)) - | "c" -> - (match Stdlib.( ! ) c__386_ with - | Stdlib.Option.None -> - let _field_sexp__397_ = _field_sexp__397_ () in - let fvalue__405_ = int_of_sexp _field_sexp__397_ in - Stdlib.( := ) c__386_ (Stdlib.Option.Some fvalue__405_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__394_ - (field_name__396_ :: Stdlib.( ! ) duplicates__394_)) - | "d" -> - (match Stdlib.( ! ) d__388_ with - | Stdlib.Option.None -> - let _field_sexp__397_ = _field_sexp__397_ () in - let fvalue__403_ = int_of_sexp _field_sexp__397_ in - Stdlib.( := ) d__388_ (Stdlib.Option.Some fvalue__403_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__394_ - (field_name__396_ :: Stdlib.( ! ) duplicates__394_)) - | "e" -> - (match Stdlib.( ! ) e__390_ with - | Stdlib.Option.None -> - let _field_sexp__397_ = _field_sexp__397_ () in - let fvalue__401_ = int_of_sexp _field_sexp__397_ in - Stdlib.( := ) e__390_ (Stdlib.Option.Some fvalue__401_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__394_ - (field_name__396_ :: Stdlib.( ! ) duplicates__394_)) - | "f" -> - (match Stdlib.( ! ) f__392_ with - | Stdlib.Option.None -> - let _field_sexp__397_ = _field_sexp__397_ () in - let fvalue__399_ = int_of_sexp _field_sexp__397_ in - Stdlib.( := ) f__392_ (Stdlib.Option.Some fvalue__399_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__394_ - (field_name__396_ :: Stdlib.( ! ) duplicates__394_)) - | _ -> - if Stdlib.( ! ) Sexplib0.Sexp_conv.record_check_extra_fields - then Stdlib.( := ) extra__395_ (field_name__396_ :: Stdlib.( ! ) extra__395_) - else ()); - iter__426_ tail__427_ - | ((Sexplib0.Sexp.Atom _ | Sexplib0.Sexp.List _) as sexp__380_) :: _ -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__425_ - sexp__380_ - | [] -> () - in - iter__426_ field_sexps__381_; - (match Stdlib.( ! ) duplicates__394_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_duplicate_fields - error_source__425_ - (Stdlib.( ! ) duplicates__394_) - sexp__380_ - | [] -> - (match Stdlib.( ! ) extra__395_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_extra_fields - error_source__425_ - (Stdlib.( ! ) extra__395_) - sexp__380_ - | [] -> - (match - ( Stdlib.( ! ) a__382_ - , Stdlib.( ! ) b__384_ - , Stdlib.( ! ) c__386_ - , Stdlib.( ! ) d__388_ - , Stdlib.( ! ) e__390_ - , Stdlib.( ! ) f__392_ ) - with - | a__383_, b__385_, c__387_, d__389_, e__391_, Stdlib.Option.Some f__393_ -> - { a = - (match a__383_ with - | Stdlib.Option.None -> default__415_ - | Stdlib.Option.Some v__416_ -> v__416_) - ; b = - (match b__385_ with - | Stdlib.Option.None -> default__417_ - | Stdlib.Option.Some v__418_ -> v__418_) - ; c = - (match c__387_ with - | Stdlib.Option.None -> default__419_ - | Stdlib.Option.Some v__420_ -> v__420_) - ; d = - (match d__389_ with - | Stdlib.Option.None -> default__421_ - | Stdlib.Option.Some v__422_ -> v__422_) - ; e = - (match e__391_ with - | Stdlib.Option.None -> default__423_ - | Stdlib.Option.Some v__424_ -> v__424_) - ; f = f__393_ - } - | _ -> - Sexplib0.Sexp_conv_error.record_undefined_elements - error_source__425_ - sexp__380_ - [ Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) f__392_) Stdlib.Option.None, "f" ]))) - | Sexplib0.Sexp.Atom _ as sexp__380_ -> - Sexplib0.Sexp_conv_error.record_list_instead_atom error_source__425_ sexp__380_ - : Sexplib0.Sexp.t -> t) - ;; - - let _ = t_of_sexp - - let sexp_of_t = - (let (default__433_ : int) = 0 - and (default__438_ : int) = 0 - and (default__443_ : int) = 0 - and (default__449_ : int) = 0 - and (drop_default__448_ : int -> int -> Stdlib.Bool.t) = ( = ) - and (drop_if__454_ : Stdlib.Unit.t -> int -> Stdlib.Bool.t) = fun () -> ( = ) 0 in - fun { a = a__430_; b = b__434_; c = c__439_; d = d__444_; e = e__450_; f = f__455_ } -> - let bnds__429_ = [] in - let bnds__429_ = - if (drop_if__454_ ()) f__455_ - then bnds__429_ - else ( - let arg__457_ = sexp_of_int f__455_ in - let bnd__456_ = Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "f"; arg__457_ ] in - bnd__456_ :: bnds__429_) - in - let bnds__429_ = - if drop_default__448_ default__449_ e__450_ - then bnds__429_ - else ( - let arg__452_ = sexp_of_int e__450_ in - let bnd__451_ = Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "e"; arg__452_ ] in - bnd__451_ :: bnds__429_) - in - let bnds__429_ = - let arg__446_ = sexp_of_int d__444_ in - if Sexplib0.Sexp_conv.( = ) (sexp_of_int default__443_) arg__446_ - then bnds__429_ - else ( - let bnd__445_ = Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "d"; arg__446_ ] in - bnd__445_ :: bnds__429_) - in - let bnds__429_ = - if [%equal: int] default__438_ c__439_ - then bnds__429_ - else ( - let arg__441_ = sexp_of_int c__439_ in - let bnd__440_ = Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "c"; arg__441_ ] in - bnd__440_ :: bnds__429_) - in - let bnds__429_ = - if [%compare.equal: int] default__433_ b__434_ - then bnds__429_ - else ( - let arg__436_ = sexp_of_int b__434_ in - let bnd__435_ = Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "b"; arg__436_ ] in - bnd__435_ :: bnds__429_) - in - let bnds__429_ = - let arg__431_ = sexp_of_int a__430_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "a"; arg__431_ ] :: bnds__429_ - in - Sexplib0.Sexp.List bnds__429_ - : t -> Sexplib0.Sexp.t) - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Record_with_special_types = struct - type t = - { a : int option [@sexp.option] - ; b : int list [@sexp.list] - ; c : int array [@sexp.array] - ; d : bool [@sexp.bool] - } - [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - - let t_of_sexp = - (let error_source__480_ = "expansion.ml.Record_with_special_types.t" in - function - | Sexplib0.Sexp.List field_sexps__466_ as sexp__465_ -> - let a__467_ = Stdlib.ref Stdlib.Option.None - and b__469_ = Stdlib.ref Stdlib.Option.None - and c__471_ = Stdlib.ref Stdlib.Option.None - and d__473_ = Stdlib.ref false - and duplicates__475_ = Stdlib.ref [] - and extra__476_ = Stdlib.ref [] in - let rec iter__486_ = function - | Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom field_name__477_ :: (([] | [ _ ]) as _field_sexps__479_)) - :: tail__487_ -> - let _field_sexp__478_ () = - match _field_sexps__479_ with - | [ x__488_ ] -> x__488_ - | [] -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__480_ - sexp__465_ - | _ -> assert false - in - (match field_name__477_ with - | "a" -> - (match Stdlib.( ! ) a__467_ with - | Stdlib.Option.None -> - let _field_sexp__478_ = _field_sexp__478_ () in - let fvalue__483_ = int_of_sexp _field_sexp__478_ in - Stdlib.( := ) a__467_ (Stdlib.Option.Some fvalue__483_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__475_ - (field_name__477_ :: Stdlib.( ! ) duplicates__475_)) - | "b" -> - (match Stdlib.( ! ) b__469_ with - | Stdlib.Option.None -> - let _field_sexp__478_ = _field_sexp__478_ () in - let fvalue__482_ = list_of_sexp int_of_sexp _field_sexp__478_ in - Stdlib.( := ) b__469_ (Stdlib.Option.Some fvalue__482_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__475_ - (field_name__477_ :: Stdlib.( ! ) duplicates__475_)) - | "c" -> - (match Stdlib.( ! ) c__471_ with - | Stdlib.Option.None -> - let _field_sexp__478_ = _field_sexp__478_ () in - let fvalue__481_ = array_of_sexp int_of_sexp _field_sexp__478_ in - Stdlib.( := ) c__471_ (Stdlib.Option.Some fvalue__481_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__475_ - (field_name__477_ :: Stdlib.( ! ) duplicates__475_)) - | "d" -> - if Stdlib.( ! ) d__473_ - then - Stdlib.( := ) - duplicates__475_ - (field_name__477_ :: Stdlib.( ! ) duplicates__475_) - else ( - match _field_sexps__479_ with - | [] -> Stdlib.( := ) d__473_ true - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_sexp_bool_with_payload - error_source__480_ - sexp__465_) - | _ -> - if Stdlib.( ! ) Sexplib0.Sexp_conv.record_check_extra_fields - then Stdlib.( := ) extra__476_ (field_name__477_ :: Stdlib.( ! ) extra__476_) - else ()); - iter__486_ tail__487_ - | ((Sexplib0.Sexp.Atom _ | Sexplib0.Sexp.List _) as sexp__465_) :: _ -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__480_ - sexp__465_ - | [] -> () - in - iter__486_ field_sexps__466_; - (match Stdlib.( ! ) duplicates__475_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_duplicate_fields - error_source__480_ - (Stdlib.( ! ) duplicates__475_) - sexp__465_ - | [] -> - (match Stdlib.( ! ) extra__476_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_extra_fields - error_source__480_ - (Stdlib.( ! ) extra__476_) - sexp__465_ - | [] -> - (match - ( Stdlib.( ! ) a__467_ - , Stdlib.( ! ) b__469_ - , Stdlib.( ! ) c__471_ - , Stdlib.( ! ) d__473_ ) - with - | a__468_, b__470_, c__472_, d__474_ -> - { a = a__468_ - ; b = - (match b__470_ with - | Stdlib.Option.None -> [] - | Stdlib.Option.Some v__484_ -> v__484_) - ; c = - (match c__472_ with - | Stdlib.Option.None -> [||] - | Stdlib.Option.Some v__485_ -> v__485_) - ; d = d__474_ - }))) - | Sexplib0.Sexp.Atom _ as sexp__465_ -> - Sexplib0.Sexp_conv_error.record_list_instead_atom error_source__480_ sexp__465_ - : Sexplib0.Sexp.t -> t) - ;; - - let _ = t_of_sexp - - let sexp_of_t = - (fun { a = a__490_; b = b__495_; c = c__499_; d = d__502_ } -> - let bnds__489_ = [] in - let bnds__489_ = - if d__502_ - then ( - let bnd__503_ = Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "d" ] in - bnd__503_ :: bnds__489_) - else bnds__489_ - in - let bnds__489_ = - if match c__499_ with - | [||] -> true - | _ -> false - then bnds__489_ - else ( - let arg__501_ = (sexp_of_array sexp_of_int) c__499_ in - let bnd__500_ = Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "c"; arg__501_ ] in - bnd__500_ :: bnds__489_) - in - let bnds__489_ = - if match b__495_ with - | [] -> true - | _ -> false - then bnds__489_ - else ( - let arg__497_ = (sexp_of_list sexp_of_int) b__495_ in - let bnd__496_ = Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "b"; arg__497_ ] in - bnd__496_ :: bnds__489_) - in - let bnds__489_ = - match a__490_ with - | Stdlib.Option.None -> bnds__489_ - | Stdlib.Option.Some v__491_ -> - let arg__493_ = sexp_of_int v__491_ in - let bnd__492_ = Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "a"; arg__493_ ] in - bnd__492_ :: bnds__489_ - in - Sexplib0.Sexp.List bnds__489_ - : t -> Sexplib0.Sexp.t) - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Record_with_omit_nil = struct - type t = - { a : int option [@sexp.omit_nil] - ; b : int list [@sexp.omit_nil] - ; c : unit [@sexp.omit_nil] - ; d : int [@sexp.omit_nil] - } - [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - - let t_of_sexp = - (let error_source__535_ = "expansion.ml.Record_with_omit_nil.t" in - function - | Sexplib0.Sexp.List field_sexps__506_ as sexp__505_ -> - let a__507_ = Stdlib.ref Stdlib.Option.None - and b__509_ = Stdlib.ref Stdlib.Option.None - and c__511_ = Stdlib.ref Stdlib.Option.None - and d__513_ = Stdlib.ref Stdlib.Option.None - and duplicates__515_ = Stdlib.ref [] - and extra__516_ = Stdlib.ref [] in - let rec iter__532_ = function - | Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom field_name__517_ :: (([] | [ _ ]) as _field_sexps__519_)) - :: tail__533_ -> - let _field_sexp__518_ () = - match _field_sexps__519_ with - | [ x__534_ ] -> x__534_ - | [] -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__535_ - sexp__505_ - | _ -> assert false - in - (match field_name__517_ with - | "a" -> - (match Stdlib.( ! ) a__507_ with - | Stdlib.Option.None -> - let _field_sexp__518_ = _field_sexp__518_ () in - let fvalue__523_ = option_of_sexp int_of_sexp _field_sexp__518_ in - Stdlib.( := ) a__507_ (Stdlib.Option.Some fvalue__523_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__515_ - (field_name__517_ :: Stdlib.( ! ) duplicates__515_)) - | "b" -> - (match Stdlib.( ! ) b__509_ with - | Stdlib.Option.None -> - let _field_sexp__518_ = _field_sexp__518_ () in - let fvalue__522_ = list_of_sexp int_of_sexp _field_sexp__518_ in - Stdlib.( := ) b__509_ (Stdlib.Option.Some fvalue__522_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__515_ - (field_name__517_ :: Stdlib.( ! ) duplicates__515_)) - | "c" -> - (match Stdlib.( ! ) c__511_ with - | Stdlib.Option.None -> - let _field_sexp__518_ = _field_sexp__518_ () in - let fvalue__521_ = unit_of_sexp _field_sexp__518_ in - Stdlib.( := ) c__511_ (Stdlib.Option.Some fvalue__521_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__515_ - (field_name__517_ :: Stdlib.( ! ) duplicates__515_)) - | "d" -> - (match Stdlib.( ! ) d__513_ with - | Stdlib.Option.None -> - let _field_sexp__518_ = _field_sexp__518_ () in - let fvalue__520_ = int_of_sexp _field_sexp__518_ in - Stdlib.( := ) d__513_ (Stdlib.Option.Some fvalue__520_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__515_ - (field_name__517_ :: Stdlib.( ! ) duplicates__515_)) - | _ -> - if Stdlib.( ! ) Sexplib0.Sexp_conv.record_check_extra_fields - then Stdlib.( := ) extra__516_ (field_name__517_ :: Stdlib.( ! ) extra__516_) - else ()); - iter__532_ tail__533_ - | ((Sexplib0.Sexp.Atom _ | Sexplib0.Sexp.List _) as sexp__505_) :: _ -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__535_ - sexp__505_ - | [] -> () - in - iter__532_ field_sexps__506_; - (match Stdlib.( ! ) duplicates__515_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_duplicate_fields - error_source__535_ - (Stdlib.( ! ) duplicates__515_) - sexp__505_ - | [] -> - (match Stdlib.( ! ) extra__516_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_extra_fields - error_source__535_ - (Stdlib.( ! ) extra__516_) - sexp__505_ - | [] -> - (match - ( Stdlib.( ! ) a__507_ - , Stdlib.( ! ) b__509_ - , Stdlib.( ! ) c__511_ - , Stdlib.( ! ) d__513_ ) - with - | a__508_, b__510_, c__512_, d__514_ -> - { a = - (match a__508_ with - | Stdlib.Option.Some v__525_ -> v__525_ - | Stdlib.Option.None -> - (try option_of_sexp int_of_sexp (Sexplib0.Sexp.List []) with - | Sexplib0.Sexp_conv_error.Of_sexp_error (e__524_, _) -> - Stdlib.raise - (Sexplib0.Sexp_conv_error.Of_sexp_error (e__524_, sexp__505_)))) - ; b = - (match b__510_ with - | Stdlib.Option.Some v__527_ -> v__527_ - | Stdlib.Option.None -> - (try list_of_sexp int_of_sexp (Sexplib0.Sexp.List []) with - | Sexplib0.Sexp_conv_error.Of_sexp_error (e__526_, _) -> - Stdlib.raise - (Sexplib0.Sexp_conv_error.Of_sexp_error (e__526_, sexp__505_)))) - ; c = - (match c__512_ with - | Stdlib.Option.Some v__529_ -> v__529_ - | Stdlib.Option.None -> - (try unit_of_sexp (Sexplib0.Sexp.List []) with - | Sexplib0.Sexp_conv_error.Of_sexp_error (e__528_, _) -> - Stdlib.raise - (Sexplib0.Sexp_conv_error.Of_sexp_error (e__528_, sexp__505_)))) - ; d = - (match d__514_ with - | Stdlib.Option.Some v__531_ -> v__531_ - | Stdlib.Option.None -> - (try int_of_sexp (Sexplib0.Sexp.List []) with - | Sexplib0.Sexp_conv_error.Of_sexp_error (e__530_, _) -> - Stdlib.raise - (Sexplib0.Sexp_conv_error.Of_sexp_error (e__530_, sexp__505_)))) - }))) - | Sexplib0.Sexp.Atom _ as sexp__505_ -> - Sexplib0.Sexp_conv_error.record_list_instead_atom error_source__535_ sexp__505_ - : Sexplib0.Sexp.t -> t) - ;; - - let _ = t_of_sexp - - let sexp_of_t = - (fun { a = a__537_; b = b__539_; c = c__541_; d = d__543_ } -> - let bnds__536_ = [] in - let bnds__536_ = - match sexp_of_int d__543_ with - | Sexplib0.Sexp.List [] -> bnds__536_ - | arg__544_ -> - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "d"; arg__544_ ] :: bnds__536_ - in - let bnds__536_ = - match sexp_of_unit c__541_ with - | Sexplib0.Sexp.List [] -> bnds__536_ - | arg__542_ -> - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "c"; arg__542_ ] :: bnds__536_ - in - let bnds__536_ = - match sexp_of_list sexp_of_int b__539_ with - | Sexplib0.Sexp.List [] -> bnds__536_ - | arg__540_ -> - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "b"; arg__540_ ] :: bnds__536_ - in - let bnds__536_ = - match sexp_of_option sexp_of_int a__537_ with - | Sexplib0.Sexp.List [] -> bnds__536_ - | arg__538_ -> - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "a"; arg__538_ ] :: bnds__536_ - in - Sexplib0.Sexp.List bnds__536_ - : t -> Sexplib0.Sexp.t) - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Variant_with_sexp_list = struct - type t = A of int list [@sexp.list] [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - - let t_of_sexp = - (let error_source__547_ = "expansion.ml.Variant_with_sexp_list.t" in - function - | Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom (("a" | "A") as _tag__550_) :: sexp_args__551_) as - _sexp__549_ -> A (Sexplib0.Sexp_conv.list_map int_of_sexp sexp_args__551_) - | Sexplib0.Sexp.Atom ("a" | "A") as sexp__548_ -> - Sexplib0.Sexp_conv_error.stag_takes_args error_source__547_ sexp__548_ - | Sexplib0.Sexp.List (Sexplib0.Sexp.List _ :: _) as sexp__546_ -> - Sexplib0.Sexp_conv_error.nested_list_invalid_sum error_source__547_ sexp__546_ - | Sexplib0.Sexp.List [] as sexp__546_ -> - Sexplib0.Sexp_conv_error.empty_list_invalid_sum error_source__547_ sexp__546_ - | sexp__546_ -> - Sexplib0.Sexp_conv_error.unexpected_stag error_source__547_ sexp__546_ - : Sexplib0.Sexp.t -> t) - ;; - - let _ = t_of_sexp - - let sexp_of_t = - (fun (A l__552_) -> - Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom "A" :: Sexplib0.Sexp_conv.list_map sexp_of_int l__552_) - : t -> Sexplib0.Sexp.t) - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Poly_variant_with_sexp_list = struct - type t = [ `A of int list [@sexp.list] ] [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - - let __t_of_sexp__ = - (let error_source__559_ = "expansion.ml.Poly_variant_with_sexp_list.t" in - function - | Sexplib0.Sexp.Atom atom__554_ as _sexp__556_ -> - (match atom__554_ with - | "A" -> Sexplib0.Sexp_conv_error.ptag_takes_args error_source__559_ _sexp__556_ - | _ -> Sexplib0.Sexp_conv_error.no_variant_match ()) - | Sexplib0.Sexp.List (Sexplib0.Sexp.Atom atom__554_ :: sexp_args__557_) as - _sexp__556_ -> - (match atom__554_ with - | "A" as _tag__558_ -> `A (Sexplib0.Sexp_conv.list_map int_of_sexp sexp_args__557_) - | _ -> Sexplib0.Sexp_conv_error.no_variant_match ()) - | Sexplib0.Sexp.List (Sexplib0.Sexp.List _ :: _) as sexp__555_ -> - Sexplib0.Sexp_conv_error.nested_list_invalid_poly_var error_source__559_ sexp__555_ - | Sexplib0.Sexp.List [] as sexp__555_ -> - Sexplib0.Sexp_conv_error.empty_list_invalid_poly_var error_source__559_ sexp__555_ - : Sexplib0.Sexp.t -> t) - ;; - - let _ = __t_of_sexp__ - - let t_of_sexp = - (let error_source__561_ = "expansion.ml.Poly_variant_with_sexp_list.t" in - fun sexp__560_ -> - try __t_of_sexp__ sexp__560_ with - | Sexplib0.Sexp_conv_error.No_variant_match -> - Sexplib0.Sexp_conv_error.no_matching_variant_found error_source__561_ sexp__560_ - : Sexplib0.Sexp.t -> t) - ;; - - let _ = t_of_sexp - - let sexp_of_t = - (fun (`A l__562_) -> - Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom "A" :: Sexplib0.Sexp_conv.list_map sexp_of_int l__562_) - : t -> Sexplib0.Sexp.t) - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Record_allowing_extra_fields = struct - type t = { a : int } [@@allow_extra_fields] [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - - let t_of_sexp = - (let error_source__574_ = "expansion.ml.Record_allowing_extra_fields.t" in - function - | Sexplib0.Sexp.List field_sexps__565_ as sexp__564_ -> - let a__566_ = Stdlib.ref Stdlib.Option.None - and duplicates__568_ = Stdlib.ref [] - and extra__569_ = Stdlib.ref [] in - let rec iter__575_ = function - | Sexplib0.Sexp.List - (Sexplib0.Sexp.Atom field_name__570_ :: (([] | [ _ ]) as _field_sexps__572_)) - :: tail__576_ -> - let _field_sexp__571_ () = - match _field_sexps__572_ with - | [ x__577_ ] -> x__577_ - | [] -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__574_ - sexp__564_ - | _ -> assert false - in - (match field_name__570_ with - | "a" -> - (match Stdlib.( ! ) a__566_ with - | Stdlib.Option.None -> - let _field_sexp__571_ = _field_sexp__571_ () in - let fvalue__573_ = int_of_sexp _field_sexp__571_ in - Stdlib.( := ) a__566_ (Stdlib.Option.Some fvalue__573_) - | Stdlib.Option.Some _ -> - Stdlib.( := ) - duplicates__568_ - (field_name__570_ :: Stdlib.( ! ) duplicates__568_)) - | _ -> ()); - iter__575_ tail__576_ - | ((Sexplib0.Sexp.Atom _ | Sexplib0.Sexp.List _) as sexp__564_) :: _ -> - Sexplib0.Sexp_conv_error.record_only_pairs_expected - error_source__574_ - sexp__564_ - | [] -> () - in - iter__575_ field_sexps__565_; - (match Stdlib.( ! ) duplicates__568_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_duplicate_fields - error_source__574_ - (Stdlib.( ! ) duplicates__568_) - sexp__564_ - | [] -> - (match Stdlib.( ! ) extra__569_ with - | _ :: _ -> - Sexplib0.Sexp_conv_error.record_extra_fields - error_source__574_ - (Stdlib.( ! ) extra__569_) - sexp__564_ - | [] -> - (match Stdlib.( ! ) a__566_ with - | Stdlib.Option.Some a__567_ -> { a = a__567_ } - | _ -> - Sexplib0.Sexp_conv_error.record_undefined_elements - error_source__574_ - sexp__564_ - [ Sexplib0.Sexp_conv.( = ) (Stdlib.( ! ) a__566_) Stdlib.Option.None, "a" ]))) - | Sexplib0.Sexp.Atom _ as sexp__564_ -> - Sexplib0.Sexp_conv_error.record_list_instead_atom error_source__574_ sexp__564_ - : Sexplib0.Sexp.t -> t) - ;; - - let _ = t_of_sexp - - let sexp_of_t = - (fun { a = a__579_ } -> - let bnds__578_ = [] in - let bnds__578_ = - let arg__580_ = sexp_of_int a__579_ in - Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "a"; arg__580_ ] :: bnds__578_ - in - Sexplib0.Sexp.List bnds__578_ - : t -> Sexplib0.Sexp.t) - ;; - - let _ = sexp_of_t - - [@@@end] -end - -module Opaque = struct - type t = (int[@sexp.opaque]) list [@@deriving_inline sexp] - - let _ = fun (_ : t) -> () - - let t_of_sexp = - (fun x__582_ -> list_of_sexp Sexplib0.Sexp_conv.opaque_of_sexp x__582_ - : Sexplib0.Sexp.t -> t) - ;; - - let _ = t_of_sexp - - let sexp_of_t = - (fun x__583_ -> sexp_of_list Sexplib0.Sexp_conv.sexp_of_opaque x__583_ - : t -> Sexplib0.Sexp.t) - ;; - - let _ = sexp_of_t - - [@@@end] -end diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/expansion.mli b/bench/vendored/ppx_sexp_conv.v0.15.1/test/expansion.mli deleted file mode 100644 index feafa891..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/expansion.mli +++ /dev/null @@ -1,450 +0,0 @@ -open! Base - -module Abstract : sig - type t [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S with type t := t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Tuple : sig - type t = int * int * int [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S with type t := t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Record : sig - type t = - { a : int - ; b : int - ; c : int - } - [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S with type t := t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Mutable_record : sig - type t = - { mutable a : int - ; mutable b : int - ; mutable c : int - } - [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S with type t := t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Variant : sig - type t = - | A - | B of int * int - | C of - { a : int - ; b : int - ; d : int - } - | D of - { mutable a : int - ; mutable b : int - ; mutable t : int - } - [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S with type t := t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Poly_variant : sig - type t = - [ `A - | `B of int - ] - [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - val sexp_of_t : t -> Sexplib0.Sexp.t - val t_of_sexp : Sexplib0.Sexp.t -> t - val __t_of_sexp__ : Sexplib0.Sexp.t -> t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Inline_poly_variant : sig - type t = - [ Poly_variant.t - | `C of int * int - ] - [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - val sexp_of_t : t -> Sexplib0.Sexp.t - val t_of_sexp : Sexplib0.Sexp.t -> t - val __t_of_sexp__ : Sexplib0.Sexp.t -> t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Recursive : sig - type t = - | Banana of t - | Orange - [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S with type t := t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Nonrecursive : sig - open Recursive - - type nonrec t = t [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S with type t := t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Mutually_recursive : sig - type a = - | A - | B of b - | C of - { a : a - ; b : b - ; c : c - } - - and b = - { a : a - ; b : b - } - - and c = int [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - val sexp_of_a : a -> Sexplib0.Sexp.t - val sexp_of_b : b -> Sexplib0.Sexp.t - val sexp_of_c : c -> Sexplib0.Sexp.t - val a_of_sexp : Sexplib0.Sexp.t -> a - val b_of_sexp : Sexplib0.Sexp.t -> b - val c_of_sexp : Sexplib0.Sexp.t -> c - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Alias : sig - type t = Recursive.t [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S with type t := t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Re_export : sig - type t = Recursive.t = - | Banana of t - | Orange - [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S with type t := t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Unary : sig - type 'a t = 'a list option [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S1 with type 'a t := 'a t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Binary : sig - type ('a, 'b) t = ('a, 'b) Either.t [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S2 with type ('a, 'b) t := ('a, 'b) t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module First_order : sig - type 'a t = 'a -> 'a [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S1 with type 'a t := 'a t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Second_order : sig - type ('a, 'b) t = ('a -> 'a) -> ('a -> 'b) -> ('b -> 'b) -> 'a -> 'b - [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S2 with type ('a, 'b) t := ('a, 'b) t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Named_arguments : sig - type t = ?a:int -> b:int -> int -> int [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S with type t := t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Gadt : sig - type _ t = - | A : _ option t - | B : int -> int t - | C : 'a list -> unit t - [@@deriving_inline sexp_of] - - include sig - [@@@ocaml.warning "-32"] - - val sexp_of_t : ('a__001_ -> Sexplib0.Sexp.t) -> 'a__001_ t -> Sexplib0.Sexp.t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Recursive_record_containing_variant : sig - type t = - { a : [ `A of t ] - ; b : [ `B ] - } - [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S with type t := t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Poly_record : sig - type t = - { a : 'a. 'a list - ; b : 'b. 'b option - ; c : 'c. 'c - } - [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S with type t := t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Record_with_defaults : sig - type t = - { a : int - ; b : int - ; c : int - ; d : int - ; e : int - ; f : int - } - [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S with type t := t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Record_with_special_types : sig - type t = - { a : int option - ; b : int list - ; c : int array - ; d : bool - } - [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S with type t := t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Record_with_omit_nil : sig - type t = - { a : int option - ; b : int list - ; c : unit - ; d : int - } - [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S with type t := t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Variant_with_sexp_list : sig - type t = A of int list [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S with type t := t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Poly_variant_with_sexp_list : sig - type t = [ `A of int list ] [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - val sexp_of_t : t -> Sexplib0.Sexp.t - val t_of_sexp : Sexplib0.Sexp.t -> t - val __t_of_sexp__ : Sexplib0.Sexp.t -> t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Record_allowing_extra_fields : sig - type t = { a : int } [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S with type t := t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end - -module Opaque : sig - type t = int list [@@deriving_inline sexp] - - include sig - [@@@ocaml.warning "-32"] - - include Sexplib0.Sexpable.S with type t := t - end - [@@ocaml.doc "@inline"] - - [@@@end] -end diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/lib/conv_test.ml b/bench/vendored/ppx_sexp_conv.v0.15.1/test/lib/conv_test.ml deleted file mode 100644 index 32392dc2..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/lib/conv_test.ml +++ /dev/null @@ -1,63 +0,0 @@ -open Ppx_sexp_conv_lib -open Conv - -let%test_module "Exceptions" = - (module struct - let check_sexp exn string = - match sexp_of_exn_opt exn with - | None -> raise exn - | Some sexp -> - let sexp_as_string = Ppx_sexp_conv_lib.Sexp.to_string sexp in - if sexp_as_string <> string then failwith sexp_as_string - ;; - - (* first global exceptions, checking different arities since they - don't have the same representation *) - exception Arg0 [@@deriving sexp] - exception Arg1 of int [@@deriving sexp] - exception Arg2 of int * int [@@deriving sexp] - - let%test_unit _ = check_sexp Arg0 "conv_test.ml.Arg0" - let%test_unit _ = check_sexp (Arg1 1) "(conv_test.ml.Arg1 1)" - let%test_unit _ = check_sexp (Arg2 (2, 3)) "(conv_test.ml.Arg2 2 3)" - - (* now local exceptions *) - let exn (type a) a sexp_of_a = - let module M = struct - exception E of a [@@deriving sexp] - end - in - M.E a - ;; - - let%test_unit "incompatible exceptions with the same name" = - let e_int = exn 1 sexp_of_int in - let e_string = exn "a" sexp_of_string in - check_sexp e_int "(conv_test.ml.E 1)"; - check_sexp e_string "(conv_test.ml.E a)" - ;; - - let%test_unit "sexp converters are finalized properly for local exceptions" = - Gc.compact (); - Gc.compact (); - let size_before = - Ppx_sexp_conv_lib.Conv.Exn_converter.For_unit_tests_only.size () - in - let e = exn 2.5 sexp_of_float in - let size_after_local_exn = - Ppx_sexp_conv_lib.Conv.Exn_converter.For_unit_tests_only.size () - in - let e_finalized = ref false in - Gc.finalise (fun _ -> e_finalized := true) e; - check_sexp e "(conv_test.ml.E 2.5)"; - Gc.compact (); - Gc.compact (); - assert !e_finalized; - let size_after_gc = - Ppx_sexp_conv_lib.Conv.Exn_converter.For_unit_tests_only.size () - in - assert (size_before + 1 = size_after_local_exn); - assert (size_before = size_after_gc) - ;; - end) -;; diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/lib/conv_test.mli b/bench/vendored/ppx_sexp_conv.v0.15.1/test/lib/conv_test.mli deleted file mode 100644 index 74bb7298..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/lib/conv_test.mli +++ /dev/null @@ -1 +0,0 @@ -(*_ This signature is deliberately empty. *) diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/lib/dune b/bench/vendored/ppx_sexp_conv.v0.15.1/test/lib/dune deleted file mode 100644 index 2e553572..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/lib/dune +++ /dev/null @@ -1,2 +0,0 @@ -(library (name ppx_sexp_conv_lib_test) (libraries ppx_sexp_conv_lib) - (preprocess (pps ppxlib ppx_sexp_conv ppx_here ppx_inline_test))) \ No newline at end of file diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/nonrec_test.ml b/bench/vendored/ppx_sexp_conv.v0.15.1/test/nonrec_test.ml deleted file mode 100644 index 1b45e572..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/nonrec_test.ml +++ /dev/null @@ -1,126 +0,0 @@ -open Ppx_sexp_conv_lib.Conv - -type t = float [@@deriving sexp] - -module M : sig - type t = float list [@@deriving sexp] -end = struct - type nonrec t = t list [@@deriving sexp] -end - -type 'a u = 'a [@@deriving sexp] - -module M2 : sig - type 'a u = 'a list [@@deriving sexp] -end = struct - type nonrec 'a u = 'a u list [@@deriving sexp] -end - -type 'a v = 'a w - -and 'a w = A of 'a v [@@deriving sexp] - -type 'a v_ = 'a v [@@deriving sexp] -type 'a w_ = 'a w [@@deriving sexp] - -module M3 : sig - type 'a v = 'a w_ [@@deriving sexp] - type 'a w = 'a v_ [@@deriving sexp] -end = struct - type nonrec 'a v = 'a w - - and 'a w = 'a v [@@deriving sexp] -end - -type t0 = A of t0 [@@deriving sexp] - -module B : sig - type nonrec t0 = t0 [@@deriving sexp] -end = struct - type nonrec t0 = t0 = A of t0 [@@deriving sexp] -end - -type t1 = A of t2 - -and t2 = B of t1 [@@deriving sexp] - -module C : sig - type nonrec t1 = t1 [@@deriving sexp] - type nonrec t2 = t2 [@@deriving sexp] -end = struct - type nonrec t1 = t1 = A of t2 - - and t2 = t2 = B of t1 [@@deriving sexp] -end - -type 'a v1 = A of 'a v2 - -and 'a v2 = B of 'a v1 [@@deriving sexp] - -module D : sig - type nonrec 'a v1 = 'a v1 [@@deriving sexp] - type nonrec 'a v2 = 'a v2 [@@deriving sexp] -end = struct - type nonrec 'a v1 = 'a v1 = A of 'a v2 - - and 'a v2 = 'a v2 = B of 'a v1 [@@deriving sexp] -end - -type +'a w1 - -module E = struct - type nonrec +'a w1 = 'a w1 -end - -type 'a y1 = A of 'a y2 - -and 'a y2 = B of 'a y1 - -module F : sig - type nonrec 'a y2 = B of 'a y1 - type nonrec 'a y1 = 'a y1 -end = struct - type nonrec 'a y1 = 'a y1 = A of 'a y2 - - and 'a y2 = B of 'a y1 -end - -type z1 = A of z1 - -module G : sig - module A : sig - type z2 = A of z2 - end - - module B : sig - type z2 = A of z2 - end - - module C : sig - type z2 = A of z2 - end -end = struct - type z2 = z1 = A of z1 - - module A = struct - type nonrec z2 = z1 = A of z2 - end - - module B = struct - type nonrec z2 = z2 = A of z2 - end - - module C = struct - type nonrec z2 = z2 = A of z1 - end -end - -type ('a, 'b) zz = A of 'a * 'b - -module H = struct - type nonrec ('a, 'b) zz = ('a, 'b) zz = A of 'a * 'b -end - -module I = struct - type nonrec 'a zz = ('a, 'a) zz -end diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/ppx_sexp_test.ml b/bench/vendored/ppx_sexp_conv.v0.15.1/test/ppx_sexp_test.ml deleted file mode 100644 index 3d815691..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/ppx_sexp_test.ml +++ /dev/null @@ -1,898 +0,0 @@ -open Ppx_sexp_conv_lib -open Conv - -(* Module names below are used in error messages being tested. *) -[@@@warning "-unused-module"] - -module Sum_and_polymorphic_variants = struct - type poly = - [ `No_arg - | `One_arg of int - | `One_tuple of int * string - | `Two_args of int * string - ] - [@@deriving sexp, sexp_grammar] - - let%test_unit _ = - List.iter - (fun (value, sexp) -> - assert (sexp_of_poly value = sexp); - assert (poly_of_sexp sexp = value)) - [ `No_arg, Sexp.Atom "No_arg" - ; (`One_arg 1, Sexp.(List [ Atom "One_arg"; Atom "1" ])) - ; ( `One_tuple (1, "a") - , Sexp.(List [ Atom "One_tuple"; List [ Atom "1"; Atom "a" ] ]) ) - ; (`Two_args (1, "a"), Sexp.(List [ Atom "Two_args"; List [ Atom "1"; Atom "a" ] ])) - ] - ;; - - type nominal = - | No_arg - | One_arg of int - | One_tuple of (int * string) - | Two_args of int * string - [@@deriving sexp, sexp_grammar] - - let%test_unit _ = - List.iter - (fun (value, sexp) -> - assert (sexp_of_nominal value = sexp); - assert (nominal_of_sexp sexp = value)) - [ No_arg, Sexp.Atom "No_arg" - ; (One_arg 1, Sexp.(List [ Atom "One_arg"; Atom "1" ])) - ; (One_tuple (1, "a"), Sexp.(List [ Atom "One_tuple"; List [ Atom "1"; Atom "a" ] ])) - ; (Two_args (1, "a"), Sexp.(List [ Atom "Two_args"; Atom "1"; Atom "a" ])) - ] - ;; -end - -module Records = struct - type t = - { a : int - ; b : (float * string) list option - } - [@@deriving sexp, sexp_grammar] - - let%test_unit _ = - let t = { a = 2; b = Some [ 1., "a"; 2.3, "b" ] } in - let sexp = Sexplib.Sexp.of_string "((a 2)(b (((1 a)(2.3 b)))))" in - assert (t_of_sexp sexp = t); - assert (sexp_of_t t = sexp) - ;; - - let%expect_test _ = - let sexp = Sexplib.Sexp.of_string "((a)(b ()))" in - Expect_test_helpers_core.show_raise (fun () -> t_of_sexp sexp); - [%expect - {| - (raised ( - Of_sexp_error - "ppx_sexp_test.ml.Records.t_of_sexp: record conversion: only pairs expected, their first element must be an atom" - (invalid_sexp ((a) (b ()))))) |}] - ;; - - let%expect_test _ = - let sexp = Sexplib.Sexp.of_string "((a 1)(a))" in - Expect_test_helpers_core.show_raise (fun () -> t_of_sexp sexp); - [%expect - {| - (raised ( - Of_sexp_error - "ppx_sexp_test.ml.Records.t_of_sexp: duplicate fields: a" - (invalid_sexp ((a 1) (a))))) |}] - ;; - - let%expect_test _ = - let sexp = Sexplib.Sexp.of_string "((a 3 4))" in - Expect_test_helpers_core.show_raise (fun () -> t_of_sexp sexp); - [%expect - {| - (raised ( - Of_sexp_error - "ppx_sexp_test.ml.Records.t_of_sexp: record conversion: only pairs expected, their first element must be an atom" - (invalid_sexp (a 3 4)))) |}] - ;; - - let%expect_test _ = - let sexp = Sexplib.Sexp.of_string "((c 3))" in - Expect_test_helpers_core.show_raise (fun () -> t_of_sexp sexp); - [%expect - {| - (raised ( - Of_sexp_error - "ppx_sexp_test.ml.Records.t_of_sexp: extra fields: c" - (invalid_sexp ((c 3))))) |}] - ;; -end - -module Inline_records = struct - type t = - | A of - { a : int - ; b : (float * string) list option - } - | B of int - [@@deriving sexp, sexp_grammar] - - let%test_unit _ = - let t = A { a = 2; b = Some [ 1., "a"; 2.3, "b" ] } in - let sexp = Sexplib.Sexp.of_string "(A (a 2)(b (((1 a)(2.3 b)))))" in - assert (t_of_sexp sexp = t); - assert (sexp_of_t t = sexp) - ;; -end - -module User_specified_conversion = struct - type my_float = float - - let sexp_of_my_float n = Sexp.Atom (Printf.sprintf "%.4f" n) - let my_float_of_sexp = float_of_sexp - - let%test_unit _ = - let my_float : my_float = 1.2 in - let sexp = Sexp.Atom "1.2000" in - assert (my_float_of_sexp sexp = my_float); - assert (sexp_of_my_float my_float = sexp) - ;; -end - -module Exceptions : sig - (* no sexp_grammars for exceptions, as they can't be parsed *) - exception E0 [@@deriving sexp] - exception E1 of string [@@deriving sexp] - exception E2 of string * int [@@deriving sexp] - exception E_tuple of (string * int) [@@deriving sexp] - - exception - E_record of - { a : string - ; b : int - } - [@@deriving sexp] -end = struct - exception E0 [@@deriving sexp] - exception E1 of string [@@deriving sexp] - exception E2 of string * int [@@deriving sexp] - exception E_tuple of (string * int) [@@deriving sexp] - - exception - E_record of - { a : string - ; b : int - } - [@@deriving sexp] - - let%test_unit _ = - let cases = - [ E0, "ppx_sexp_test.ml.Exceptions.E0" - ; E1 "a", "(ppx_sexp_test.ml.Exceptions.E1 a)" - ; E2 ("b", 2), "(ppx_sexp_test.ml.Exceptions.E2 b 2)" - ; E_tuple ("c", 3), "(ppx_sexp_test.ml.Exceptions.E_tuple(c 3))" - ; E_record { a = "c"; b = 3 }, "(ppx_sexp_test.ml.Exceptions.E_record(a c)(b 3))" - ] - in - List.iter - (fun (exn, sexp_as_str) -> - let sexp = Sexplib.Sexp.of_string sexp_as_str in - assert ([%sexp_of: exn] exn = sexp)) - cases - ;; -end - -module Abstract_types_are_allowed_in_structures : sig - type t [@@deriving sexp, sexp_grammar] -end = struct - type t [@@deriving sexp, sexp_grammar] -end - -module Manifest_types = struct - type a = { t : int } - type b = a = { t : int } [@@deriving sexp, sexp_grammar] -end - -module Uses_of_exn = struct - type t = int * exn [@@deriving sexp_of] -end - -module Function_types : sig - type t1 = int -> unit [@@deriving sexp, sexp_grammar] - type t2 = label:int -> ?optional:int -> unit -> unit [@@deriving sexp, sexp_grammar] -end = struct - type t1 = int -> unit [@@deriving sexp, sexp_grammar] - type t2 = label:int -> ?optional:int -> unit -> unit [@@deriving sexp, sexp_grammar] -end - -module No_unused_rec = struct - type r = { r : int } [@@deriving sexp, sexp_grammar] -end - -module Field_name_should_not_be_rewritten = struct - open No_unused_rec - - type nonrec r = { r : r } - - let _ = fun (r : r) -> r.r -end - -module Polymorphic_variant_inclusion = struct - type sub1 = - [ `C1 - | `C2 - ] - [@@deriving sexp, sexp_grammar] - - type 'b sub2 = - [ `C4 - | `C5 of 'b - ] - [@@deriving sexp, sexp_grammar] - - type ('a, 'b) t = [ sub1 | `C3 of [ `Nested of 'a ] | 'b sub2 | `C6 ] option - [@@deriving sexp, sexp_grammar] - - let%test_unit _ = - let cases : ((string * string, float) t * _) list = - [ None, "()" - ; Some `C1, "(C1)" - ; Some `C2, "(C2)" - ; Some (`C3 (`Nested ("a", "b"))), "((C3 (Nested (a b))))" - ; Some `C4, "(C4)" - ; Some (`C5 1.5), "((C5 1.5))" - ; Some `C6, "(C6)" - ] - in - List.iter - (fun (t, sexp_as_str) -> - let sexp = Sexplib.Sexp.of_string sexp_as_str in - assert ([%of_sexp: (string * string, float) t] sexp = t); - assert ([%sexp_of: (string * string, float) t] t = sexp)) - cases - ;; - - type sub1_alias = sub1 [@@deriving sexp_poly, sexp_grammar] - - type u = - [ `A - | sub1_alias - | `D - ] - [@@deriving sexp, sexp_grammar] - - let%test_unit _ = - let cases : (u * _) list = [ `A, "A"; `C1, "C1"; `C2, "C2"; `D, "D" ] in - List.iter - (fun (u, sexp_as_str) -> - let sexp = Sexplib.Sexp.of_string sexp_as_str in - assert ([%of_sexp: u] sexp = u); - assert ([%sexp_of: u] u = sexp)) - cases - ;; -end - -module Polymorphic_record_field = struct - type 'x t = - { poly : 'a 'b. 'a list - ; maybe_x : 'x option - } - [@@deriving sexp] - - let%test_unit _ = - let t x = { poly = []; maybe_x = Some x } in - let sexp = Sexplib.Sexp.of_string "((poly ())(maybe_x (1)))" in - assert (t_of_sexp int_of_sexp sexp = t 1); - assert (sexp_of_t sexp_of_int (t 1) = sexp) - ;; -end - -module No_unused_value_warnings : sig end = struct - module No_warning : sig - type t = [ `A ] [@@deriving sexp, sexp_grammar] - end = struct - type t = [ `A ] [@@deriving sexp, sexp_grammar] - end - - module Empty = struct end - - module No_warning2 (X : sig - type t [@@deriving sexp, sexp_grammar] - end) = - struct end - - (* this one can't be handled (what if Empty was a functor, huh?) *) - (* module No_warning3(X : sig type t with sexp end) = Empty *) - module type S = sig - type t = [ `A ] [@@deriving sexp, sexp_grammar] - end - - module No_warning4 : S = struct - type t = [ `A ] [@@deriving sexp, sexp_grammar] - end - - module No_warning5 : S = ( - ( - struct - type t = [ `A ] [@@deriving sexp, sexp_grammar] - end : - S) : - S) - - module Nested_functors (M1 : sig - type t [@@deriving sexp, sexp_grammar] - end) (M2 : sig - type t [@@deriving sexp, sexp_grammar] - end) = - struct end - - let () = - let module M : sig - type t [@@deriving sexp, sexp_grammar] - end = struct - type t [@@deriving sexp, sexp_grammar] - end - in - () - ;; - - module Include = struct - include ( - struct - type t = int [@@deriving sexp, sexp_grammar] - end : - sig - type t [@@deriving sexp, sexp_grammar] - end - with type t := int) - end -end - -module Default = struct - type t = { a : int [@default 2] } [@@deriving sexp, sexp_grammar] - - let%test _ = Sexp.(List [ List [ Atom "a"; Atom "1" ] ]) = sexp_of_t { a = 1 } - let%test _ = Sexp.(List [ List [ Atom "a"; Atom "2" ] ]) = sexp_of_t { a = 2 } - let%test _ = t_of_sexp Sexp.(List [ List [ Atom "a"; Atom "1" ] ]) = { a = 1 } - let%test _ = t_of_sexp Sexp.(List [ List [ Atom "a"; Atom "2" ] ]) = { a = 2 } - let%test _ = t_of_sexp Sexp.(List []) = { a = 2 } -end - -module Type_alias = struct - (* checking that the [as 'a] is supported and ignored in signatures, that it still - exports the sexp_of_t__ when needed *) - module B : sig - type a = [ `A ] - type t = [ `A ] as 'a constraint 'a = a [@@deriving sexp, sexp_grammar] - end = struct - type a = [ `A ] [@@deriving sexp, sexp_grammar] - type t = [ `A ] [@@deriving sexp, sexp_grammar] - end - - let%test _ = Sexp.to_string (B.sexp_of_t `A) = "A" - let%test _ = `A = B.t_of_sexp (Sexplib.Sexp.of_string "A") - - module B2 = struct - type t = - [ B.t - | `B - ] - [@@deriving sexp, sexp_grammar] - end - - module C : sig - type t = int as 'a [@@deriving sexp, sexp_grammar] - end = struct - type t = int [@@deriving sexp, sexp_grammar] - end - - module D : sig - type t = 'a constraint 'a = int [@@deriving sexp, sexp_grammar] - end = struct - type t = int [@@deriving sexp, sexp_grammar] - end -end - -module Tricky_variants = struct - (* Checking that the generated code compiles (there used to be a problem with subtyping - constraints preventing proper generalization). *) - type t = [ `a ] [@@deriving sexp, sexp_grammar] - type 'a u = [ t | `b of 'a ] * int [@@deriving sexp, sexp_grammar] -end - -module Drop_default = struct - open! Base - open Expect_test_helpers_core - - type t = { a : int } [@@deriving equal] - - let test ?cr t_of_sexp sexp_of_t = - let ( = ) = Sexp.( = ) in - require ?cr [%here] (Sexp.(List [ List [ Atom "a"; Atom "1" ] ]) = sexp_of_t { a = 1 }); - require ?cr [%here] (Sexp.(List []) = sexp_of_t { a = 2 }); - let ( = ) = equal in - require ?cr [%here] (t_of_sexp Sexp.(List [ List [ Atom "a"; Atom "1" ] ]) = { a = 1 }); - require ?cr [%here] (t_of_sexp Sexp.(List [ List [ Atom "a"; Atom "2" ] ]) = { a = 2 }); - require ?cr [%here] (t_of_sexp Sexp.(List []) = { a = 2 }) - ;; - - type my_int = int [@@deriving sexp, sexp_grammar] - - module Poly = struct - type nonrec t = t = { a : my_int [@default 2] [@sexp_drop_default Poly.( = )] } - [@@deriving sexp, sexp_grammar] - - let%test_unit _ = test t_of_sexp sexp_of_t - end - - module Equal = struct - let equal_my_int = equal_int - - type nonrec t = t = { a : my_int [@default 2] [@sexp_drop_default.equal] } - [@@deriving sexp, sexp_grammar] - - let%test_unit _ = test t_of_sexp sexp_of_t - end - - module Compare = struct - let compare_my_int = compare_int - - type nonrec t = t = { a : my_int [@default 2] [@sexp_drop_default.compare] } - [@@deriving sexp, sexp_grammar] - - let%test_unit _ = test t_of_sexp sexp_of_t - end - - module Sexp = struct - type nonrec t = t = { a : my_int [@default 2] [@sexp_drop_default.sexp] } - [@@deriving sexp, sexp_grammar] - - let%test_unit _ = test t_of_sexp sexp_of_t - end -end - -module Drop_if = struct - type t = { a : int [@default 2] [@sexp_drop_if fun x -> x mod 2 = 0] } - [@@deriving sexp, sexp_grammar] - - let%test _ = Sexp.(List [ List [ Atom "a"; Atom "1" ] ]) = sexp_of_t { a = 1 } - let%test _ = Sexp.(List []) = sexp_of_t { a = 2 } - let%test _ = Sexp.(List [ List [ Atom "a"; Atom "3" ] ]) = sexp_of_t { a = 3 } - let%test _ = Sexp.(List []) = sexp_of_t { a = 4 } - let%test _ = t_of_sexp Sexp.(List [ List [ Atom "a"; Atom "1" ] ]) = { a = 1 } - let%test _ = t_of_sexp Sexp.(List [ List [ Atom "a"; Atom "2" ] ]) = { a = 2 } - let%test _ = t_of_sexp Sexp.(List [ List [ Atom "a"; Atom "3" ] ]) = { a = 3 } - let%test _ = t_of_sexp Sexp.(List [ List [ Atom "a"; Atom "4" ] ]) = { a = 4 } - let%test _ = t_of_sexp Sexp.(List []) = { a = 2 } - - type u = - { a : int - [@sexp_drop_if - fun x -> - (* pa_type_conv used to drop parens altogether, causing type errors in the - following code *) - let pair = x, 2 in - match Some pair with - | None -> true - | Some (x, y) -> x = y] - } - [@@deriving sexp, sexp_grammar] -end - -module Omit_nil = struct - type natural_option = int - - let sexp_of_natural_option i = if i >= 0 then sexp_of_int i else sexp_of_unit () - - let natural_option_of_sexp = function - | Sexp.List [] -> -1 - | sexp -> int_of_sexp sexp - ;; - - let natural_option_sexp_grammar : natural_option Sexplib0.Sexp_grammar.t = - { untyped = Union [ List Empty; Integer ] } - ;; - - let check sexp_of_t t_of_sexp str t = - let sexp = Sexplib.Sexp.of_string str in - assert (sexp = sexp_of_t t); - assert (t_of_sexp sexp = t) - ;; - - type t = { a : natural_option [@sexp.omit_nil] } [@@deriving sexp, sexp_grammar] - - let%test_unit _ = check sexp_of_t t_of_sexp "()" { a = -1 } - let%test_unit _ = check sexp_of_t t_of_sexp "((a 1))" { a = 1 } - - type t2 = A of { a : int list [@sexp.omit_nil] } [@@deriving sexp, sexp_grammar] - - let%test_unit _ = check sexp_of_t2 t2_of_sexp "(A)" (A { a = [] }) - let%test_unit _ = check sexp_of_t2 t2_of_sexp "(A (a (1)))" (A { a = [ 1 ] }) -end - -module No_unused_rec_warning = struct - type r = { field : r -> unit } [@@deriving sexp_of] -end - -module True_and_false = struct - type t = - | True - | False - [@@deriving sexp, sexp_grammar] - - let%test _ = Sexp.to_string (sexp_of_t True) = "True" - let%test _ = Sexp.to_string (sexp_of_t False) = "False" - let%test _ = True = t_of_sexp (Sexplib.Sexp.of_string "True") - let%test _ = False = t_of_sexp (Sexplib.Sexp.of_string "False") - let%test _ = True = t_of_sexp (Sexplib.Sexp.of_string "true") - let%test _ = False = t_of_sexp (Sexplib.Sexp.of_string "false") - - type u = - | True of int - | False of int - [@@deriving sexp, sexp_grammar] - - let%test _ = Sexp.to_string (sexp_of_u (True 1)) = "(True 1)" - let%test _ = Sexp.to_string (sexp_of_u (False 2)) = "(False 2)" - let%test _ = True 1 = u_of_sexp (Sexplib.Sexp.of_string "(True 1)") - let%test _ = False 2 = u_of_sexp (Sexplib.Sexp.of_string "(False 2)") - let%test _ = True 1 = u_of_sexp (Sexplib.Sexp.of_string "(true 1)") - let%test _ = False 2 = u_of_sexp (Sexplib.Sexp.of_string "(false 2)") - - exception True [@@deriving sexp] - - let%test _ = "ppx_sexp_test.ml.True_and_false.True" = Sexp.to_string (sexp_of_exn True) - - exception False of int [@@deriving sexp] - - let%test _ = - "(ppx_sexp_test.ml.True_and_false.False 1)" = Sexp.to_string (sexp_of_exn (False 1)) - ;; - - type v = - [ `True - | `False of int - ] - [@@deriving sexp, sexp_grammar] - - let%test _ = Sexp.to_string (sexp_of_v `True) = "True" - let%test _ = Sexp.to_string (sexp_of_v (`False 2)) = "(False 2)" -end - -module Gadt = struct - let is_eq sexp str = - let sexp2 = Sexplib.Sexp.of_string str in - if sexp <> sexp2 - then ( - Printf.printf "%S vs %S\n%!" (Sexp.to_string sexp) str; - assert false) - ;; - - (* plain type without argument *) - type 'a s = Packed : 'a s [@@deriving sexp_of] - - let%test_unit _ = is_eq ([%sexp_of: int s] Packed) "Packed" - - (* two kind of existential variables *) - type 'a t = Packed : 'a * _ * ('b[@sexp.opaque]) -> 'a t [@warning "-3"] - [@@deriving sexp_of] - - let%test_unit _ = - is_eq ([%sexp_of: int t] (Packed (2, "asd", 1.))) "(Packed 2 _ )" - ;; - - (* plain type with argument *) - type 'a u = A : 'a -> 'a u [@@deriving sexp_of] - - let%test_unit _ = is_eq ([%sexp_of: int u] (A 2)) "(A 2)" - - (* recursive *) - type v = A : v option -> v [@@deriving sexp_of] - - let%test_unit _ = is_eq ([%sexp_of: v] (A (Some (A None)))) "(A((A())))" - - (* implicit existential variable *) - type w = A : 'a * int * ('a -> string) -> w [@@deriving sexp_of] - - let%test_unit _ = is_eq ([%sexp_of: w] (A (1., 2, string_of_float))) "(A _ 2 )" - - (* tricky variable naming *) - type 'a x = A : 'a -> 'b x [@@deriving sexp_of] - - let%test_unit _ = is_eq ([%sexp_of: int x] (A 1.)) "(A _)" - - (* interaction with inline record *) - type _ x2 = A : { x : 'c } -> 'c x2 [@@deriving sexp_of] - - let%test_unit _ = is_eq ([%sexp_of: int x2] (A { x = 1 })) "(A (x 1))" - - (* unused but colliding variables *) - type (_, _) y = A : ('a, 'a) y [@@deriving sexp_of] - - let%test_unit _ = is_eq ([%sexp_of: (int, int) y] A) "A" - - (* making sure we're not reversing parameters *) - type (_, _) z = A : ('a * 'b) -> ('a, 'b) z [@@deriving sexp_of] - - let%test_unit _ = is_eq ([%sexp_of: (int, string) z] (A (1, "a"))) "(A (1 a))" - - (* interaction with universal quantifiers *) - type _ z2 = A : { x : 'c. 'c option } -> 'c z2 [@@deriving sexp_of] - - let%test_unit _ = is_eq ([%sexp_of: unit z2] (A { x = None })) "(A (x ()))" -end - -module Anonymous_variable = struct - type _ t = int [@@deriving sexp, sexp_grammar] - - let%test _ = Sexp.to_string ([%sexp_of: _ t] 2) = "2" - let%test _ = [%of_sexp: _ t] (Sexplib.Sexp.of_string "2") = 2 - - (* making sure we don't generate signatures like (_ -> Sexp.t) -> _ t -> Sexp.t which - are too general *) - module M : sig - type _ t [@@deriving sexp, sexp_grammar] - end = struct - type 'a t = 'a [@@deriving sexp, sexp_grammar] - end -end - -module Record_field_disambiguation = struct - type a = - { fl : float - ; b : b - } - - and b = { fl : int } [@@deriving sexp, sexp_grammar] -end - -module Private = struct - type t = private int [@@deriving sexp_of] - type ('a, 'b) u = private t [@@deriving sexp_of] - type ('a, 'b, 'c) v = private ('a, 'b) u [@@deriving sexp_of] -end - -module Nonregular_types = struct - type 'a nonregular = - | Leaf of 'a - | Branch of ('a * 'a) nonregular - [@@deriving sexp, sexp_grammar] - - type 'a variant = [ `A of 'a ] [@@deriving sexp, sexp_grammar] - - type ('a, 'b) nonregular_with_variant = - | Branch of ([ | 'a list variant ], 'b) nonregular_with_variant - [@@deriving sexp, sexp_grammar] -end - -module Opaque = struct - type t = (int[@sexp.opaque]) list [@@deriving sexp, sexp_grammar] - - let sexp = Sexplib.Sexp.of_string "( )" - let t = [ 1; 2 ] - - let%test _ = sexp_of_t t = sexp - - let%test _ = - match t_of_sexp sexp with - | _ -> false - | exception _ -> true - ;; - - type u = ([ `A of int ][@sexp.opaque]) [@@deriving sexp, sexp_grammar] - - let sexp = Sexplib.Sexp.of_string "" - let u = `A 1 - - let%test _ = sexp_of_u u = sexp - - let%test _ = - match u_of_sexp sexp with - | _ -> false - | exception _ -> true - ;; -end - -module Optional = struct - type t = { optional : int option [@sexp.option] } [@@deriving sexp, sexp_grammar] - - let sexp = Sexplib.Sexp.of_string "()" - let t = { optional = None } - - let%test _ = t_of_sexp sexp = t - let%test _ = sexp_of_t t = sexp - - let sexp = Sexplib.Sexp.of_string "((optional 5))" - let t = { optional = Some 5 } - - let%test _ = t_of_sexp sexp = t - let%test _ = sexp_of_t t = sexp -end - -module Nonempty = struct - type t = - { list : int list [@sexp.list] - ; array : int array [@sexp.array] - } - [@@deriving sexp, sexp_grammar] - - let sexp = Sexplib.Sexp.of_string "()" - let t = { list = []; array = [||] } - - let%test _ = t_of_sexp sexp = t - let%test _ = sexp_of_t t = sexp - - let sexp = Sexplib.Sexp.of_string "((list (1 2 3)) (array (3 2 1)))" - let t = { list = [ 1; 2; 3 ]; array = [| 3; 2; 1 |] } - - let%test _ = t_of_sexp sexp = t - let%test _ = sexp_of_t t = sexp -end - -module Boolean = struct - type t = { no_arg : bool [@sexp.bool] } [@@deriving sexp, sexp_grammar] - - let sexp = Sexplib.Sexp.of_string "()" - let t = { no_arg = false } - - let%test _ = t_of_sexp sexp = t - let%test _ = sexp_of_t t = sexp - - let sexp = Sexplib.Sexp.of_string "((no_arg))" - let t = { no_arg = true } - - let%test _ = t_of_sexp sexp = t - let%test _ = sexp_of_t t = sexp - - type t_allow_extra_fields = { no_arg : bool [@sexp.bool] } - [@@deriving sexp, sexp_grammar] [@@sexp.allow_extra_fields] - - let%expect_test _ = - Expect_test_helpers_core.require_does_raise ~cr:CR_soon [%here] (fun () -> - let r = t_allow_extra_fields_of_sexp (Sexplib.Sexp.of_string "((no_arg true))") in - print_endline (Bool.to_string r.no_arg)); - [%expect - {| - (Of_sexp_error - "ppx_sexp_test.ml.Boolean.t_allow_extra_fields_of_sexp: record conversion: a [sexp.bool] field was given a payload." - (invalid_sexp ((no_arg true)))) |}] - ;; -end - -module Inline = struct - type t = A of int list [@sexp.list] [@@deriving sexp, sexp_grammar] - - let sexp = Sexplib.Sexp.of_string "(A 1 2 3)" - let t = A [ 1; 2; 3 ] - - let%test _ = t_of_sexp sexp = t - let%test _ = sexp_of_t t = sexp - - type u = [ `A of int list [@sexp.list] ] [@@deriving sexp, sexp_grammar] - - let sexp = Sexplib.Sexp.of_string "(A 1 2 3)" - let u = `A [ 1; 2; 3 ] - - let%test _ = u_of_sexp sexp = u - let%test _ = sexp_of_u u = sexp -end - -module Variance = struct - type (+'a, -'b, 'c, +_, -_, _) t [@@deriving sexp, sexp_grammar] -end - -module Clash = struct - (* Same name for type-var and type-name; must be careful when introducing rigid type names. *) - type 'hey hey = Hey of 'hey [@@deriving sexp, sexp_grammar] - type 'hey rigid_hey = Hey of 'hey [@@deriving sexp, sexp_grammar] - type ('foo, 'rigid_foo) foo = Foo of 'foo [@@deriving sexp, sexp_grammar] - type 'rigid_bar rigid_rigid_bar = Bar [@@deriving sexp, sexp_grammar] -end - -module Applicative_functor_types = struct - module Bidirectional_map = struct - type ('k1, 'k2) t - - module S (K1 : sig - type t - end) (K2 : sig - type t - end) = - struct - type nonrec t = (K1.t, K2.t) t - end - - module type Of_sexpable = sig - type t [@@deriving of_sexp, sexp_grammar] - end - - let s__t_of_sexp - (type k1 k2) - (module K1 : Of_sexpable with type t = k1) - (module K2 : Of_sexpable with type t = k2) - (_ : Sexp.t) - : (k1, k2) t - = - assert false - ;; - - (* You would actually have to write this manually for functors. *) - let s__t_sexp_grammar - (type k1 k2) - (module K1 : Of_sexpable with type t = k1) - (module K2 : Of_sexpable with type t = k2) - = - [%sexp_grammar: (K1.t * K2.t) list] - ;; - end - - module Int = struct - type t = int [@@deriving of_sexp, sexp_grammar] - end - - module String = struct - type t = string [@@deriving of_sexp, sexp_grammar] - end - - module M : sig - type t = Bidirectional_map.S(String)(Int).t [@@deriving of_sexp, sexp_grammar] - end = struct - type t = Bidirectional_map.S(String)(Int).t [@@deriving of_sexp, sexp_grammar] - end -end - -module Type_extensions = struct - let _ = ([%sexp_of: int] : [%sexp_of: int]) - let _ = ([%of_sexp: int] : [%of_sexp: int]) -end - -module Allow_extra_fields = struct - let should_raise f x = - try - ignore (f x); - false - with - | _ -> true - ;; - - module M1 = struct - type t1 = { a : int } [@@deriving sexp] - type t2 = t1 = { a : int } [@@deriving sexp, sexp_grammar] [@@sexp.allow_extra_fields] - - let sexp = Sexplib.Sexp.of_string "((a 1))" - let sexp_extra = Sexplib.Sexp.of_string "((a 1)(b 2))" - - let%test _ = t2_of_sexp sexp = t2_of_sexp sexp_extra - let%test _ = t1_of_sexp sexp = t2_of_sexp sexp - let%test _ = should_raise t1_of_sexp sexp_extra - - let%expect_test _ = - Expect_test_helpers_core.require_does_raise ~cr:CR_soon [%here] (fun () -> - t2_of_sexp (Sexplib.Sexp.of_string "((a 1)(a))")); - [%expect - {| - (Of_sexp_error - "ppx_sexp_test.ml.Allow_extra_fields.M1.t2_of_sexp: duplicate fields: a" - (invalid_sexp ((a 1) (a)))) |}] - ;; - end - - module M2 = struct - type t1 = A of { a : int list } [@@deriving sexp] - - type t2 = t1 = A of { a : int list } [@sexp.allow_extra_fields] - [@@deriving sexp, sexp_grammar] - - let sexp = Sexplib.Sexp.of_string "(A (a (0)))" - let sexp_extra = Sexplib.Sexp.of_string "(A (a (0))(b 2))" - - let%test _ = t2_of_sexp sexp = t2_of_sexp sexp_extra - let%test _ = t1_of_sexp sexp = t2_of_sexp sexp - let%test _ = should_raise t1_of_sexp sexp_extra - end -end - -module Default_values_and_polymorphism = struct - type t = - { a : int list [@sexp.list] - ; b : 'b. 'b -> int - } - [@@deriving of_sexp] -end diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/ppx_sexp_test.mli b/bench/vendored/ppx_sexp_conv.v0.15.1/test/ppx_sexp_test.mli deleted file mode 100644 index e69de29b..00000000 diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/dune b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/dune deleted file mode 100644 index 6183b1f3..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/dune +++ /dev/null @@ -1,12 +0,0 @@ -(library (name ppx_sexp_conv_test_sexp_grammar) - (libraries base expect_test_helpers_core.expect_test_helpers_base - sexp_grammar) - (preprocess (pps ppx_sexp_conv ppx_expect ppx_here))) - -(rule (targets regular_vs_polymorphic_variants.diff) - (deps test_regular_variants.ml test_polymorphic_variants.ml) (mode promote) - (action - (bash - "%{bin:patdiff-for-review} %{bin:patdiff} %{deps} > %{targets} || true"))) - -(alias (name DEFAULT) (deps regular_vs_polymorphic_variants.diff)) \ No newline at end of file diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/regular_vs_polymorphic_variants.diff b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/regular_vs_polymorphic_variants.diff deleted file mode 100644 index d2366a72..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/regular_vs_polymorphic_variants.diff +++ /dev/null @@ -1,73 +0,0 @@ ------- test_regular_variants.ml -++++++ test_polymorphic_variants.ml -@|============================================================ --| | A --| | B -+| [ `A -+| | `B -+| ] -@|============================================================ --| { case_sensitivity = Case_sensitive_except_first_character -+| { case_sensitivity = Case_sensitive -@|============================================================ --| | A of int * int --| | B of string -+| [ `A of int * int -+| | `B of string -+| ] -@|============================================================ --| type t = With_sexp.t = --| | A of int * int --| | B of string -+| type t = -+| [ `A of int * int -+| | `B of string -+| ] -@|============================================================ --| { case_sensitivity = Case_sensitive_except_first_character -+| { case_sensitivity = Case_sensitive -@|============================================================ --| ( int_sexp_grammar.untyped --| , Cons (int_sexp_grammar.untyped, Empty) ) -+| ( List -+| (Cons -+| ( int_sexp_grammar.untyped -+| , Cons (int_sexp_grammar.untyped, Empty) )) -+| , Empty ) -@|============================================================ --| print_s (With_sexp.sexp_of_t (A (1, 2))); --| print_s (With_sexp.sexp_of_t (B "foo")); -+| print_s (With_sexp.sexp_of_t (`A (1, 2))); -+| print_s (With_sexp.sexp_of_t (`B "foo")); -@|============================================================ --| (A 1 2) -+| (A (1 2)) -@|============================================================ --| | Int of int --| | List of int list --| | Sexp_dot_list of int list [@sexp.list] -+| [ `Int of int -+| | `List of int list -+| | `Sexp_dot_list of int list [@sexp.list] -+| ] -@|============================================================ --| type t = With_sexp.t = --| | Int of int --| | List of int list --| | Sexp_dot_list of int list [@sexp.list] -+| type t = -+| [ `Int of int -+| | `List of int list -+| | `Sexp_dot_list of int list [@sexp.list] -+| ] -@|============================================================ --| { case_sensitivity = Case_sensitive_except_first_character -+| { case_sensitivity = Case_sensitive -@|============================================================ --| print_s (With_sexp.sexp_of_t (Int 1)); -+| print_s (With_sexp.sexp_of_t (`Int 1)); -@|============================================================ --| print_s (With_sexp.sexp_of_t (List l)); --| print_s (With_sexp.sexp_of_t (Sexp_dot_list l))); -+| print_s (With_sexp.sexp_of_t (`List l)); -+| print_s (With_sexp.sexp_of_t (`Sexp_dot_list l))); diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_allow_extra_fields.ml b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_allow_extra_fields.ml deleted file mode 100644 index 7f611e8b..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_allow_extra_fields.ml +++ /dev/null @@ -1,119 +0,0 @@ -open! Base - -module _ = struct - type t = { a : int } [@@sexp.allow_extra_fields] [@@deriving_inline sexp_grammar] - - let _ = fun (_ : t) -> () - - let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy - (lazy - (List - (Fields - { allow_extra_fields = true - ; fields = - [ No_tag - { name = "a" - ; required = true - ; args = Cons (int_sexp_grammar.untyped, Empty) - } - ] - }))) - } - ;; - - let _ = t_sexp_grammar - - [@@@end] -end - -module _ = struct - type t = { a : int } [@@deriving_inline sexp_grammar] - - let _ = fun (_ : t) -> () - - let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy - (lazy - (List - (Fields - { allow_extra_fields = false - ; fields = - [ No_tag - { name = "a" - ; required = true - ; args = Cons (int_sexp_grammar.untyped, Empty) - } - ] - }))) - } - ;; - - let _ = t_sexp_grammar - - [@@@end] -end - -module _ = struct - type t = - | Allow_extra_fields of { foo : int } [@sexp.allow_extra_fields] - | Forbid_extra_fields of { bar : int } - [@@deriving_inline sexp_grammar] - - let _ = fun (_ : t) -> () - - let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy - (lazy - (Variant - { case_sensitivity = Case_sensitive_except_first_character - ; clauses = - [ No_tag - { name = "Allow_extra_fields" - ; clause_kind = - List_clause - { args = - Fields - { allow_extra_fields = true - ; fields = - [ No_tag - { name = "foo" - ; required = true - ; args = Cons (int_sexp_grammar.untyped, Empty) - } - ] - } - } - } - ; No_tag - { name = "Forbid_extra_fields" - ; clause_kind = - List_clause - { args = - Fields - { allow_extra_fields = false - ; fields = - [ No_tag - { name = "bar" - ; required = true - ; args = Cons (int_sexp_grammar.untyped, Empty) - } - ] - } - } - } - ] - })) - } - ;; - - let _ = t_sexp_grammar - - [@@@end] - - let _ = Allow_extra_fields { foo = 1 } - let _ = Forbid_extra_fields { bar = 1 } -end diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_allow_extra_fields.mli b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_allow_extra_fields.mli deleted file mode 100644 index 74bb7298..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_allow_extra_fields.mli +++ /dev/null @@ -1 +0,0 @@ -(*_ This signature is deliberately empty. *) diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_base_map.ml b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_base_map.ml deleted file mode 100644 index 2a74fc16..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_base_map.ml +++ /dev/null @@ -1,35 +0,0 @@ -open! Base - -module type S = sig - type t [@@deriving sexp_grammar] -end - -module Key = struct - type t = int [@@deriving sexp_grammar] -end - -module Pair = struct - type ('a, 'b) t = 'a * 'b [@@deriving sexp_grammar] - - module M (A : T) = struct - type 'b t = A.t * 'b - end - - let m__t_sexp_grammar (type a) (module Key : S with type t = a) v_sexp_grammar = - t_sexp_grammar Key.t_sexp_grammar v_sexp_grammar - ;; -end - -type t = string Pair.M(Key).t [@@deriving_inline sexp_grammar] - -let _ = fun (_ : t) -> () - -let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy (lazy (Pair.m__t_sexp_grammar (module Key) string_sexp_grammar).untyped) - } -;; - -let _ = t_sexp_grammar - -[@@@end] diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_base_map.mli b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_base_map.mli deleted file mode 100644 index 74bb7298..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_base_map.mli +++ /dev/null @@ -1 +0,0 @@ -(*_ This signature is deliberately empty. *) diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_coverage_for_deriving.ml b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_coverage_for_deriving.ml deleted file mode 100644 index 2353cb06..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_coverage_for_deriving.ml +++ /dev/null @@ -1,615 +0,0 @@ -open Ppx_sexp_conv_lib.Conv - -[@@@warning "-37"] (* allow unused constructors *) - -type abstract_a [@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : abstract_a) -> () - -let (abstract_a_sexp_grammar : abstract_a Sexplib0.Sexp_grammar.t) = - { untyped = Any "Test_coverage_for_deriving.abstract_a" } -;; - -let _ = abstract_a_sexp_grammar - -[@@@end] - -type abstract_b [@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : abstract_b) -> () - -let (abstract_b_sexp_grammar : abstract_b Sexplib0.Sexp_grammar.t) = - { untyped = Any "Test_coverage_for_deriving.abstract_b" } -;; - -let _ = abstract_b_sexp_grammar - -[@@@end] - -type integer = int [@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : integer) -> () -let (integer_sexp_grammar : integer Sexplib0.Sexp_grammar.t) = int_sexp_grammar -let _ = integer_sexp_grammar - -[@@@end] - -type tuple = int * string [@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : tuple) -> () - -let (tuple_sexp_grammar : tuple Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy - (lazy - (List - (Cons (int_sexp_grammar.untyped, Cons (string_sexp_grammar.untyped, Empty))))) - } -;; - -let _ = tuple_sexp_grammar - -[@@@end] - -type pos = - { x : float - ; y : float - } -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : pos) -> () - -let (pos_sexp_grammar : pos Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy - (lazy - (List - (Fields - { allow_extra_fields = false - ; fields = - [ No_tag - { name = "x" - ; required = true - ; args = Cons (float_sexp_grammar.untyped, Empty) - } - ; No_tag - { name = "y" - ; required = true - ; args = Cons (float_sexp_grammar.untyped, Empty) - } - ] - }))) - } -;; - -let _ = pos_sexp_grammar - -[@@@end] - -type 'a unary = 'a list [@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : 'a unary) -> () - -let (unary_sexp_grammar : 'a Sexplib0.Sexp_grammar.t -> 'a unary Sexplib0.Sexp_grammar.t) = - fun _'a_sexp_grammar -> list_sexp_grammar _'a_sexp_grammar -;; - -let _ = unary_sexp_grammar - -[@@@end] - -type enum = - | One - | Two - | Three -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : enum) -> () - -let (enum_sexp_grammar : enum Sexplib0.Sexp_grammar.t) = - { untyped = - Variant - { case_sensitivity = Case_sensitive_except_first_character - ; clauses = - [ No_tag { name = "One"; clause_kind = Atom_clause } - ; No_tag { name = "Two"; clause_kind = Atom_clause } - ; No_tag { name = "Three"; clause_kind = Atom_clause } - ] - } - } -;; - -let _ = enum_sexp_grammar - -[@@@end] - -type ('a, 'b) which = - | This of 'a - | That of 'b -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : ('a, 'b) which) -> () - -let (which_sexp_grammar : - 'a Sexplib0.Sexp_grammar.t - -> 'b Sexplib0.Sexp_grammar.t - -> ('a, 'b) which Sexplib0.Sexp_grammar.t) - = - fun _'a_sexp_grammar _'b_sexp_grammar -> - { untyped = - Variant - { case_sensitivity = Case_sensitive_except_first_character - ; clauses = - [ No_tag - { name = "This" - ; clause_kind = - List_clause { args = Cons (_'a_sexp_grammar.untyped, Empty) } - } - ; No_tag - { name = "That" - ; clause_kind = - List_clause { args = Cons (_'b_sexp_grammar.untyped, Empty) } - } - ] - } - } -;; - -let _ = which_sexp_grammar - -[@@@end] - -type 'a optional = - | No - | Yes of 'a -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : 'a optional) -> () - -let (optional_sexp_grammar : - 'a Sexplib0.Sexp_grammar.t -> 'a optional Sexplib0.Sexp_grammar.t) - = - fun _'a_sexp_grammar -> - { untyped = - Variant - { case_sensitivity = Case_sensitive_except_first_character - ; clauses = - [ No_tag { name = "No"; clause_kind = Atom_clause } - ; No_tag - { name = "Yes" - ; clause_kind = - List_clause { args = Cons (_'a_sexp_grammar.untyped, Empty) } - } - ] - } - } -;; - -let _ = optional_sexp_grammar - -[@@@end] - -type empty = | [@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : empty) -> () -let (empty_sexp_grammar : empty Sexplib0.Sexp_grammar.t) = { untyped = Union [] } -let _ = empty_sexp_grammar - -[@@@end] - -type _ phantom = int [@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : _ phantom) -> () - -let (phantom_sexp_grammar : - 'a__101_ Sexplib0.Sexp_grammar.t -> 'a__101_ phantom Sexplib0.Sexp_grammar.t) - = - fun _'a__101__sexp_grammar -> int_sexp_grammar -;; - -let _ = phantom_sexp_grammar - -[@@@end] - -type color = - [ `Red - | `Blue - ] -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : color) -> () - -let (color_sexp_grammar : color Sexplib0.Sexp_grammar.t) = - { untyped = - Variant - { case_sensitivity = Case_sensitive - ; clauses = - [ No_tag { name = "Red"; clause_kind = Atom_clause } - ; No_tag { name = "Blue"; clause_kind = Atom_clause } - ] - } - } -;; - -let _ = color_sexp_grammar - -[@@@end] - -type adjective = - [ color - | `Fast - | `Slow - | `Count of int - ] -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : adjective) -> () - -let (adjective_sexp_grammar : adjective Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy - (lazy - (Union - [ color_sexp_grammar.untyped - ; Variant - { case_sensitivity = Case_sensitive - ; clauses = - [ No_tag { name = "Fast"; clause_kind = Atom_clause } - ; No_tag { name = "Slow"; clause_kind = Atom_clause } - ; No_tag - { name = "Count" - ; clause_kind = - List_clause { args = Cons (int_sexp_grammar.untyped, Empty) } - } - ] - } - ])) - } -;; - -let _ = adjective_sexp_grammar - -[@@@end] - -type 'a tree = - { data : 'a - ; children : 'a tree list - } -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : 'a tree) -> () - -include struct - open struct - let (grammars__148_ : Sexplib0.Sexp_grammar.defn Stdlib.List.t Stdlib.Lazy.t) = - lazy - (let (tree_sexp_grammar - : 'a Sexplib0.Sexp_grammar.t -> 'a tree Sexplib0.Sexp_grammar.t) - = - fun _'a_sexp_grammar -> - { untyped = Tycon ("tree", [ _'a_sexp_grammar.untyped ]) } - in - [ { tycon = "tree" - ; tyvars = [ "a" ] - ; grammar = - List - (Fields - { allow_extra_fields = false - ; fields = - [ No_tag - { name = "data" - ; required = true - ; args = Cons (Tyvar "a", Empty) - } - ; No_tag - { name = "children" - ; required = true - ; args = - Cons - ( (list_sexp_grammar - (tree_sexp_grammar { untyped = Tyvar "a" })) - .untyped - , Empty ) - } - ] - }) - } - ]) - ;; - - let _ = grammars__148_ - end - - let (tree_sexp_grammar : 'a Sexplib0.Sexp_grammar.t -> 'a tree Sexplib0.Sexp_grammar.t) = - fun _'a_sexp_grammar -> - { untyped = - Recursive - (Tycon ("tree", [ _'a_sexp_grammar.untyped ]), Stdlib.Lazy.force grammars__148_) - } - ;; - - let _ = tree_sexp_grammar -end - -[@@@end] - -type alpha = int - -and beta = - { alpha : alpha - ; betas : beta list - } - -and gamma = beta list [@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : alpha) -> () -let _ = fun (_ : beta) -> () -let _ = fun (_ : gamma) -> () - -include struct - open struct - let (grammars__176_ : Sexplib0.Sexp_grammar.defn Stdlib.List.t Stdlib.Lazy.t) = - lazy - (let (alpha_sexp_grammar : alpha Sexplib0.Sexp_grammar.t) = - { untyped = Tycon ("alpha", []) } - and (beta_sexp_grammar : beta Sexplib0.Sexp_grammar.t) = - { untyped = Tycon ("beta", []) } - in - [ { tycon = "alpha"; tyvars = []; grammar = int_sexp_grammar.untyped } - ; { tycon = "beta" - ; tyvars = [] - ; grammar = - List - (Fields - { allow_extra_fields = false - ; fields = - [ No_tag - { name = "alpha" - ; required = true - ; args = Cons (alpha_sexp_grammar.untyped, Empty) - } - ; No_tag - { name = "betas" - ; required = true - ; args = - Cons ((list_sexp_grammar beta_sexp_grammar).untyped, Empty) - } - ] - }) - } - ]) - ;; - - let _ = grammars__176_ - end - - let (alpha_sexp_grammar : alpha Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy (lazy (Recursive (Tycon ("alpha", []), Stdlib.Lazy.force grammars__176_))) - } - - and (beta_sexp_grammar : beta Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy (lazy (Recursive (Tycon ("beta", []), Stdlib.Lazy.force grammars__176_))) - } - ;; - - let _ = alpha_sexp_grammar - and _ = beta_sexp_grammar -end - -let (gamma_sexp_grammar : gamma Sexplib0.Sexp_grammar.t) = - { untyped = Lazy (lazy (list_sexp_grammar beta_sexp_grammar).untyped) } -;; - -let _ = gamma_sexp_grammar - -[@@@end] - -type record_attributes = - { a : int [@default 0] - ; b : bool [@sexp.bool] - ; c : float option [@sexp.option] - ; d : string list [@sexp.list] - ; e : bytes array [@sexp.array] - ; f : Ppx_sexp_conv_lib.Sexp.t [@sexp.omit_nil] - } -[@@sexp.allow_extra_fields] [@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : record_attributes) -> () - -let (record_attributes_sexp_grammar : record_attributes Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy - (lazy - (List - (Fields - { allow_extra_fields = true - ; fields = - [ No_tag - { name = "a" - ; required = false - ; args = Cons (int_sexp_grammar.untyped, Empty) - } - ; No_tag { name = "b"; required = false; args = Empty } - ; No_tag - { name = "c" - ; required = false - ; args = Cons (float_sexp_grammar.untyped, Empty) - } - ; No_tag - { name = "d" - ; required = false - ; args = Cons (List (Many string_sexp_grammar.untyped), Empty) - } - ; No_tag - { name = "e" - ; required = false - ; args = Cons (List (Many bytes_sexp_grammar.untyped), Empty) - } - ; No_tag - { name = "f" - ; required = false - ; args = - Cons (Ppx_sexp_conv_lib.Sexp.t_sexp_grammar.untyped, Empty) - } - ] - }))) - } -;; - -let _ = record_attributes_sexp_grammar - -[@@@end] - -type variant_attributes = - | A - | B of int list [@sexp.list] - | C of - { a : int [@default 0] - ; b : bool [@sexp.bool] - ; c : float option [@sexp.option] - ; d : string list [@sexp.list] - ; e : bytes array [@sexp.array] - ; f : Ppx_sexp_conv_lib.Sexp.t [@sexp.omit_nil] - } [@sexp.allow_extra_fields] -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : variant_attributes) -> () - -let (variant_attributes_sexp_grammar : variant_attributes Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy - (lazy - (Variant - { case_sensitivity = Case_sensitive_except_first_character - ; clauses = - [ No_tag { name = "A"; clause_kind = Atom_clause } - ; No_tag - { name = "B" - ; clause_kind = List_clause { args = Many int_sexp_grammar.untyped } - } - ; No_tag - { name = "C" - ; clause_kind = - List_clause - { args = - Fields - { allow_extra_fields = true - ; fields = - [ No_tag - { name = "a" - ; required = false - ; args = Cons (int_sexp_grammar.untyped, Empty) - } - ; No_tag - { name = "b"; required = false; args = Empty } - ; No_tag - { name = "c" - ; required = false - ; args = Cons (float_sexp_grammar.untyped, Empty) - } - ; No_tag - { name = "d" - ; required = false - ; args = - Cons - ( List (Many string_sexp_grammar.untyped) - , Empty ) - } - ; No_tag - { name = "e" - ; required = false - ; args = - Cons - ( List (Many bytes_sexp_grammar.untyped) - , Empty ) - } - ; No_tag - { name = "f" - ; required = false - ; args = - Cons - ( Ppx_sexp_conv_lib.Sexp.t_sexp_grammar - .untyped - , Empty ) - } - ] - } - } - } - ] - })) - } -;; - -let _ = variant_attributes_sexp_grammar - -[@@@end] - -type polymorphic_variant_attributes = - [ `A - | `B of int list [@sexp.list] - ] -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : polymorphic_variant_attributes) -> () - -let (polymorphic_variant_attributes_sexp_grammar : - polymorphic_variant_attributes Sexplib0.Sexp_grammar.t) - = - { untyped = - Lazy - (lazy - (Variant - { case_sensitivity = Case_sensitive - ; clauses = - [ No_tag { name = "A"; clause_kind = Atom_clause } - ; No_tag - { name = "B" - ; clause_kind = List_clause { args = Many int_sexp_grammar.untyped } - } - ] - })) - } -;; - -let _ = polymorphic_variant_attributes_sexp_grammar - -[@@@end] - -type opaque = - { x : (string[@sexp.opaque]) - ; y : int -> int - } -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : opaque) -> () - -let (opaque_sexp_grammar : opaque Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy - (lazy - (List - (Fields - { allow_extra_fields = false - ; fields = - [ No_tag - { name = "x" - ; required = true - ; args = - Cons (Sexplib0.Sexp_conv.opaque_sexp_grammar.untyped, Empty) - } - ; No_tag - { name = "y" - ; required = true - ; args = Cons (Sexplib0.Sexp_conv.fun_sexp_grammar.untyped, Empty) - } - ] - }))) - } -;; - -let _ = opaque_sexp_grammar - -[@@@end] diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_coverage_for_deriving.mli b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_coverage_for_deriving.mli deleted file mode 100644 index e00f2301..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_coverage_for_deriving.mli +++ /dev/null @@ -1,283 +0,0 @@ -(** This file covers a lot of cases for [@@deriving], for both interface and - implementation. They are also exported for validation. *) - -type abstract_a [@@deriving sexp] [@@deriving_inline sexp_grammar] - -include sig - [@@@ocaml.warning "-32"] - - val abstract_a_sexp_grammar : abstract_a Sexplib0.Sexp_grammar.t -end -[@@ocaml.doc "@inline"] - -[@@@end] - -type abstract_b [@@deriving sexp] [@@deriving_inline sexp_grammar] - -include sig - [@@@ocaml.warning "-32"] - - val abstract_b_sexp_grammar : abstract_b Sexplib0.Sexp_grammar.t -end -[@@ocaml.doc "@inline"] - -[@@@end] - -type integer = int [@@deriving sexp] [@@deriving_inline sexp_grammar] - -include sig - [@@@ocaml.warning "-32"] - - val integer_sexp_grammar : integer Sexplib0.Sexp_grammar.t -end -[@@ocaml.doc "@inline"] - -[@@@end] - -type tuple = int * string [@@deriving sexp] [@@deriving_inline sexp_grammar] - -include sig - [@@@ocaml.warning "-32"] - - val tuple_sexp_grammar : tuple Sexplib0.Sexp_grammar.t -end -[@@ocaml.doc "@inline"] - -[@@@end] - -type pos = - { x : float - ; y : float - } -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -include sig - [@@@ocaml.warning "-32"] - - val pos_sexp_grammar : pos Sexplib0.Sexp_grammar.t -end -[@@ocaml.doc "@inline"] - -[@@@end] - -type 'a unary = 'a list [@@deriving sexp] [@@deriving_inline sexp_grammar] - -include sig - [@@@ocaml.warning "-32"] - - val unary_sexp_grammar : 'a Sexplib0.Sexp_grammar.t -> 'a unary Sexplib0.Sexp_grammar.t -end -[@@ocaml.doc "@inline"] - -[@@@end] - -type enum = - | One - | Two - | Three -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -include sig - [@@@ocaml.warning "-32"] - - val enum_sexp_grammar : enum Sexplib0.Sexp_grammar.t -end -[@@ocaml.doc "@inline"] - -[@@@end] - -type ('a, 'b) which = - | This of 'a - | That of 'b -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -include sig - [@@@ocaml.warning "-32"] - - val which_sexp_grammar - : 'a Sexplib0.Sexp_grammar.t - -> 'b Sexplib0.Sexp_grammar.t - -> ('a, 'b) which Sexplib0.Sexp_grammar.t -end -[@@ocaml.doc "@inline"] - -[@@@end] - -type 'a optional = - | No - | Yes of 'a -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -include sig - [@@@ocaml.warning "-32"] - - val optional_sexp_grammar - : 'a Sexplib0.Sexp_grammar.t - -> 'a optional Sexplib0.Sexp_grammar.t -end -[@@ocaml.doc "@inline"] - -[@@@end] - -type empty = | [@@deriving sexp] [@@deriving_inline sexp_grammar] - -include sig - [@@@ocaml.warning "-32"] - - val empty_sexp_grammar : empty Sexplib0.Sexp_grammar.t -end -[@@ocaml.doc "@inline"] - -[@@@end] - -type _ phantom = int [@@deriving sexp] [@@deriving_inline sexp_grammar] - -include sig - [@@@ocaml.warning "-32"] - - val phantom_sexp_grammar - : 'a__003_ Sexplib0.Sexp_grammar.t - -> 'a__003_ phantom Sexplib0.Sexp_grammar.t -end -[@@ocaml.doc "@inline"] - -[@@@end] - -type color = - [ `Red - | `Blue - ] -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -include sig - [@@@ocaml.warning "-32"] - - val color_sexp_grammar : color Sexplib0.Sexp_grammar.t -end -[@@ocaml.doc "@inline"] - -[@@@end] - -type adjective = - [ color - | `Fast - | `Slow - | `Count of int - ] -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -include sig - [@@@ocaml.warning "-32"] - - val adjective_sexp_grammar : adjective Sexplib0.Sexp_grammar.t -end -[@@ocaml.doc "@inline"] - -[@@@end] - -type 'a tree = - { data : 'a - ; children : 'a tree list - } -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -include sig - [@@@ocaml.warning "-32"] - - val tree_sexp_grammar : 'a Sexplib0.Sexp_grammar.t -> 'a tree Sexplib0.Sexp_grammar.t -end -[@@ocaml.doc "@inline"] - -[@@@end] - -type alpha = int - -and beta = - { alpha : alpha - ; betas : beta list - } - -and gamma = beta list [@@deriving sexp] [@@deriving_inline sexp_grammar] - -include sig - [@@@ocaml.warning "-32"] - - val alpha_sexp_grammar : alpha Sexplib0.Sexp_grammar.t - val beta_sexp_grammar : beta Sexplib0.Sexp_grammar.t - val gamma_sexp_grammar : gamma Sexplib0.Sexp_grammar.t -end -[@@ocaml.doc "@inline"] - -[@@@end] - -type record_attributes = - { a : int - ; b : bool - ; c : float option - ; d : string list - ; e : bytes array - ; f : Ppx_sexp_conv_lib.Sexp.t - } -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -include sig - [@@@ocaml.warning "-32"] - - val record_attributes_sexp_grammar : record_attributes Sexplib0.Sexp_grammar.t -end -[@@ocaml.doc "@inline"] - -[@@@end] - -type variant_attributes = - | A - | B of int list - | C of - { a : int - ; b : bool - ; c : float option - ; d : string list - ; e : bytes array - ; f : Ppx_sexp_conv_lib.Sexp.t - } -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -include sig - [@@@ocaml.warning "-32"] - - val variant_attributes_sexp_grammar : variant_attributes Sexplib0.Sexp_grammar.t -end -[@@ocaml.doc "@inline"] - -[@@@end] - -type polymorphic_variant_attributes = - [ `A - | `B of int list - ] -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -include sig - [@@@ocaml.warning "-32"] - - val polymorphic_variant_attributes_sexp_grammar - : polymorphic_variant_attributes Sexplib0.Sexp_grammar.t -end -[@@ocaml.doc "@inline"] - -[@@@end] - -type opaque = - { x : string - ; y : int -> int - } -[@@deriving sexp] [@@deriving_inline sexp_grammar] - -include sig - [@@@ocaml.warning "-32"] - - val opaque_sexp_grammar : opaque Sexplib0.Sexp_grammar.t -end -[@@ocaml.doc "@inline"] - -[@@@end] diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_extension.ml b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_extension.ml deleted file mode 100644 index 5ebeffe5..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_extension.ml +++ /dev/null @@ -1,19 +0,0 @@ -open! Base - -(* Not sure how much people will want to use this, considering that the input is more - complicated and specific than the output, but they have it. *) -module type S = sig - val t_sexp_grammar : [%sexp_grammar: int Map.M(String).t] -end - -module _ (M : S) : sig - val t_sexp_grammar : int Map.M(String).t Sexplib0.Sexp_grammar.t [@@warning "-32"] -end = - M - -(* The grammar is illegible, so just make sure it builds. *) - -let (_ : _ Sexplib0.Sexp_grammar.t) = [%sexp_grammar: int Map.M(String).t] - -(* This used to give a compilation error. *) -let (_ : _ Sexplib0.Sexp_grammar.t) = [%sexp_grammar: _ list] diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_extension.mli b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_extension.mli deleted file mode 100644 index 74bb7298..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_extension.mli +++ /dev/null @@ -1 +0,0 @@ -(*_ This signature is deliberately empty. *) diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_functors.ml b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_functors.ml deleted file mode 100644 index e722c419..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_functors.ml +++ /dev/null @@ -1,161 +0,0 @@ -open! Base - -module Maybe = struct - type 'a t = 'a option [@@deriving_inline sexp_grammar] - - let _ = fun (_ : 'a t) -> () - - let (t_sexp_grammar : 'a Sexplib0.Sexp_grammar.t -> 'a t Sexplib0.Sexp_grammar.t) = - fun _'a_sexp_grammar -> option_sexp_grammar _'a_sexp_grammar - ;; - - let _ = t_sexp_grammar - - [@@@end] -end - -module Make (T : sig - type 'a t [@@deriving sexp_grammar] - end) = -struct - [@@@warning "-37"] - - type 'a t = T of 'a T.t u - - and 'a u = U of 'a T.t t Maybe.t [@@deriving_inline sexp_grammar] - - let _ = fun (_ : 'a t) -> () - let _ = fun (_ : 'a u) -> () - - include struct - open struct - let (grammars__001_ : Sexplib0.Sexp_grammar.defn Stdlib.List.t Stdlib.Lazy.t) = - lazy - (let (t_sexp_grammar - : 'a Sexplib0.Sexp_grammar.t -> 'a t Sexplib0.Sexp_grammar.t) - = - fun _'a_sexp_grammar -> - { untyped = Tycon ("t", [ _'a_sexp_grammar.untyped ]) } - and (u_sexp_grammar - : 'a Sexplib0.Sexp_grammar.t -> 'a u Sexplib0.Sexp_grammar.t) - = - fun _'a_sexp_grammar -> - { untyped = Tycon ("u", [ _'a_sexp_grammar.untyped ]) } - in - [ { tycon = "t" - ; tyvars = [ "a" ] - ; grammar = - Variant - { case_sensitivity = Case_sensitive_except_first_character - ; clauses = - [ No_tag - { name = "T" - ; clause_kind = - List_clause - { args = - Cons - ( (u_sexp_grammar - (T.t_sexp_grammar { untyped = Tyvar "a" })) - .untyped - , Empty ) - } - } - ] - } - } - ; { tycon = "u" - ; tyvars = [ "a" ] - ; grammar = - Variant - { case_sensitivity = Case_sensitive_except_first_character - ; clauses = - [ No_tag - { name = "U" - ; clause_kind = - List_clause - { args = - Cons - ( (Maybe.t_sexp_grammar - (t_sexp_grammar - (T.t_sexp_grammar { untyped = Tyvar "a" }))) - .untyped - , Empty ) - } - } - ] - } - } - ]) - ;; - - let _ = grammars__001_ - end - - let (t_sexp_grammar : 'a Sexplib0.Sexp_grammar.t -> 'a t Sexplib0.Sexp_grammar.t) = - fun _'a_sexp_grammar -> - { untyped = - Recursive - (Tycon ("t", [ _'a_sexp_grammar.untyped ]), Stdlib.Lazy.force grammars__001_) - } - - and (u_sexp_grammar : 'a Sexplib0.Sexp_grammar.t -> 'a u Sexplib0.Sexp_grammar.t) = - fun _'a_sexp_grammar -> - { untyped = - Recursive - (Tycon ("u", [ _'a_sexp_grammar.untyped ]), Stdlib.Lazy.force grammars__001_) - } - ;; - - let _ = t_sexp_grammar - and _ = u_sexp_grammar - end - - [@@@end] - - type 'a v = V of 'a t [@@deriving_inline sexp_grammar] - - let _ = fun (_ : 'a v) -> () - - let (v_sexp_grammar : 'a Sexplib0.Sexp_grammar.t -> 'a v Sexplib0.Sexp_grammar.t) = - fun _'a_sexp_grammar -> - { untyped = - Variant - { case_sensitivity = Case_sensitive_except_first_character - ; clauses = - [ No_tag - { name = "V" - ; clause_kind = - List_clause - { args = Cons ((t_sexp_grammar _'a_sexp_grammar).untyped, Empty) } - } - ] - } - } - ;; - - let _ = v_sexp_grammar - - [@@@end] -end - -module T1 = Make (Maybe) -module T2 = Make (T1) - -type t = int T2.t * int T1.t [@@deriving_inline sexp_grammar] - -let _ = fun (_ : t) -> () - -let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy - (lazy - (List - (Cons - ( (T2.t_sexp_grammar int_sexp_grammar).untyped - , Cons ((T1.t_sexp_grammar int_sexp_grammar).untyped, Empty) )))) - } -;; - -let _ = t_sexp_grammar - -[@@@end] diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_functors.mli b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_functors.mli deleted file mode 100644 index 74bb7298..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_functors.mli +++ /dev/null @@ -1 +0,0 @@ -(*_ This signature is deliberately empty. *) diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_gadt.ml b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_gadt.ml deleted file mode 100644 index 0607f706..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_gadt.ml +++ /dev/null @@ -1,74 +0,0 @@ -open! Base - -type t = T : ('a[@sexp.opaque]) -> t [@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : t) -> () - -let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy - (lazy - (Variant - { case_sensitivity = Case_sensitive_except_first_character - ; clauses = - [ No_tag - { name = "T" - ; clause_kind = - List_clause - { args = - Cons (Sexplib0.Sexp_conv.opaque_sexp_grammar.untyped, Empty) - } - } - ] - })) - } -;; - -let _ = t_sexp_grammar - -[@@@end] - -type nullary = Nullary : nullary [@@deriving sexp] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : nullary) -> () - -let (nullary_sexp_grammar : nullary Sexplib0.Sexp_grammar.t) = - { untyped = - Variant - { case_sensitivity = Case_sensitive_except_first_character - ; clauses = [ No_tag { name = "Nullary"; clause_kind = Atom_clause } ] - } - } -;; - -let _ = nullary_sexp_grammar - -[@@@end] - -(* We can't derive [of_sexp], but we can derive a sensible grammar for this type. *) -type _ grammar_only = Grammar_only : int -> string grammar_only -[@@warning "-37"] [@@deriving_inline sexp_grammar] - -let _ = fun (_ : _ grammar_only) -> () - -let (grammar_only_sexp_grammar : - 'a__016_ Sexplib0.Sexp_grammar.t -> 'a__016_ grammar_only Sexplib0.Sexp_grammar.t) - = - fun _'a__016__sexp_grammar -> - { untyped = - Variant - { case_sensitivity = Case_sensitive_except_first_character - ; clauses = - [ No_tag - { name = "Grammar_only" - ; clause_kind = - List_clause { args = Cons (int_sexp_grammar.untyped, Empty) } - } - ] - } - } -;; - -let _ = grammar_only_sexp_grammar - -[@@@end] diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_gadt.mli b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_gadt.mli deleted file mode 100644 index 74bb7298..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_gadt.mli +++ /dev/null @@ -1 +0,0 @@ -(*_ This signature is deliberately empty. *) diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_nonrec.ml b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_nonrec.ml deleted file mode 100644 index 204692e4..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_nonrec.ml +++ /dev/null @@ -1,19 +0,0 @@ -open! Base - -open struct - type t = int [@@deriving_inline sexp_grammar] - - let _ = fun (_ : t) -> () - let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = int_sexp_grammar - let _ = t_sexp_grammar - - [@@@end] -end - -type nonrec t = t [@@deriving_inline sexp_grammar] - -let _ = fun (_ : t) -> () -let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = t_sexp_grammar -let _ = t_sexp_grammar - -[@@@end] diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_nonrec.mli b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_nonrec.mli deleted file mode 100644 index 74bb7298..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_nonrec.mli +++ /dev/null @@ -1 +0,0 @@ -(*_ This signature is deliberately empty. *) diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_opaque.ml b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_opaque.ml deleted file mode 100644 index e1de935c..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_opaque.ml +++ /dev/null @@ -1,15 +0,0 @@ -open! Base - -type t = (int[@sexp.opaque]) list [@@deriving_inline sexp_grammar] - -let _ = fun (_ : t) -> () - -let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy (lazy (list_sexp_grammar Sexplib0.Sexp_conv.opaque_sexp_grammar).untyped) - } -;; - -let _ = t_sexp_grammar - -[@@@end] diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_opaque.mli b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_opaque.mli deleted file mode 100644 index 74bb7298..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_opaque.mli +++ /dev/null @@ -1 +0,0 @@ -(*_ This signature is deliberately empty. *) diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_polymorphic_variants.ml b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_polymorphic_variants.ml deleted file mode 100644 index b25e7dd6..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_polymorphic_variants.ml +++ /dev/null @@ -1,167 +0,0 @@ -open Base - -[@@@warning "-37"] - -module _ = struct - type 'a t = - [ `A - | `B - ] - [@@deriving_inline sexp_grammar] - - let _ = fun (_ : 'a t) -> () - - let (t_sexp_grammar : 'a Sexplib0.Sexp_grammar.t -> 'a t Sexplib0.Sexp_grammar.t) = - fun _'a_sexp_grammar -> - { untyped = - Variant - { case_sensitivity = Case_sensitive - ; clauses = - [ No_tag { name = "A"; clause_kind = Atom_clause } - ; No_tag { name = "B"; clause_kind = Atom_clause } - ] - } - } - ;; - - let _ = t_sexp_grammar - - [@@@end] -end - -module _ = struct - module With_sexp = struct - type t = - [ `A of int * int - | `B of string - ] - [@@deriving sexp_of] - end - - type t = - [ `A of int * int - | `B of string - ] - [@@deriving_inline sexp_grammar] - - let _ = fun (_ : t) -> () - - let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy - (lazy - (Variant - { case_sensitivity = Case_sensitive - ; clauses = - [ No_tag - { name = "A" - ; clause_kind = - List_clause - { args = - Cons - ( List - (Cons - ( int_sexp_grammar.untyped - , Cons (int_sexp_grammar.untyped, Empty) )) - , Empty ) - } - } - ; No_tag - { name = "B" - ; clause_kind = - List_clause - { args = Cons (string_sexp_grammar.untyped, Empty) } - } - ] - })) - } - ;; - - let _ = t_sexp_grammar - - [@@@end] - - open Expect_test_helpers_base - - let%expect_test _ = - print_s (With_sexp.sexp_of_t (`A (1, 2))); - print_s (With_sexp.sexp_of_t (`B "foo")); - [%expect {| - (A (1 2)) - (B foo) |}] - ;; -end - -module _ = struct - module With_sexp = struct - type t = - [ `Int of int - | `List of int list - | `Sexp_dot_list of int list [@sexp.list] - ] - [@@deriving sexp] - end - - type t = - [ `Int of int - | `List of int list - | `Sexp_dot_list of int list [@sexp.list] - ] - [@@deriving_inline sexp_grammar] - - let _ = fun (_ : t) -> () - - let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy - (lazy - (Variant - { case_sensitivity = Case_sensitive - ; clauses = - [ No_tag - { name = "Int" - ; clause_kind = - List_clause { args = Cons (int_sexp_grammar.untyped, Empty) } - } - ; No_tag - { name = "List" - ; clause_kind = - List_clause - { args = - Cons ((list_sexp_grammar int_sexp_grammar).untyped, Empty) - } - } - ; No_tag - { name = "Sexp_dot_list" - ; clause_kind = - List_clause { args = Many int_sexp_grammar.untyped } - } - ] - })) - } - ;; - - let _ = t_sexp_grammar - - [@@@end] - - let (T : (With_sexp.t, t) Type_equal.t) = T - - open Expect_test_helpers_base - - let%expect_test _ = - print_s (With_sexp.sexp_of_t (`Int 1)); - List.iter [ []; [ 1 ]; [ 1; 2 ] ] ~f:(fun l -> - print_s (With_sexp.sexp_of_t (`List l)); - print_s (With_sexp.sexp_of_t (`Sexp_dot_list l))); - [%expect - {| - (Int 1) - (List ()) - (Sexp_dot_list) - (List (1)) - (Sexp_dot_list 1) - (List (1 2)) - (Sexp_dot_list 1 2) |}] - ;; -end diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_polymorphic_variants.mli b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_polymorphic_variants.mli deleted file mode 100644 index 74bb7298..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_polymorphic_variants.mli +++ /dev/null @@ -1 +0,0 @@ -(*_ This signature is deliberately empty. *) diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_polymorphic_variants.mlt b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_polymorphic_variants.mlt deleted file mode 100644 index b5bdb1fa..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_polymorphic_variants.mlt +++ /dev/null @@ -1,110 +0,0 @@ -(* This toplevel test exercises some polymorphic variants that sexp_grammar rejects. We - show that in each case, the compiler or sexp would have given an error anyway. *) - -open Base - -type t = [ `A of int & string ] [@@deriving sexp] - -[%%expect {| -Line _, characters _-_: -Error: split_row_field/& -|}] - -type t = [ `A of int & string ] [@@deriving sexp_grammar] - -[%%expect - {| -Line _, characters _-_: -Error: sexp_grammar: intersection types are unsupported -|}] - -type t = [> `A ] [@@deriving sexp] - -[%%expect - {| -Line _, characters _-_: -Error: Type unsupported for ppx [of_sexp] conversion -|}] - -type t = [> `A ] [@@deriving sexp_grammar] - -[%%expect - {| -Line _, characters _-_: -Error: sexp_grammar: open polymorphic variant types are unsupported -|}] - -type t = [< `A ] [@@deriving sexp] - -[%%expect - {| -Line _, characters _-_: -Error: A type variable is unbound in this type declaration. -In type [< `A ] as 'a the variable 'a is unbound -|}] - -type t = [< `A ] [@@deriving sexp_grammar] - -[%%expect - {| -Line _, characters _-_: -Error: A type variable is unbound in this type declaration. -In type [< `A ] as 'a the variable 'a is unbound -|}] - -type 'a t = [< `A ] as 'a [@@deriving sexp] - -[%%expect - {| -Line _, characters _-_: -Error: Type unsupported for ppx [of_sexp] conversion -|}] - -type 'a t = [< `A ] as 'a [@@deriving sexp_grammar] - -[%%expect {| -Line _, characters _-_: -Error: sexp_grammar: type aliases are unsupported -|}] - -type a = A : [> ] -> a [@@deriving sexp] - -[%%expect - {| -Line _, characters _-_: -Error: Type unsupported for ppx [of_sexp] conversion -|}] - -type a = A : [> ] -> a [@@deriving sexp_of] - -[%%expect - {| -Line _, characters _-_: -Error: Type unsupported for ppx [sexp_of] conversion -|}] - -type a = [ `A ] [@@deriving sexp];; - -#verbose true - -let f = [%sexp_of: [< a ]] - -[%%expect {| -val f : [< a ] -> Sexp.t = -|}] - -let f = [%of_sexp: [> a ]] - -[%%expect - {| -Line _, characters _-_: -Error: Type unsupported for ppx [of_sexp] conversion -|}] - -let f = [%of_sexp: [ | a ]] - -[%%expect {| -val f : Sexp.t -> a = -|}];; - -#verbose false diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_polymorphism.ml b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_polymorphism.ml deleted file mode 100644 index de1ad553..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_polymorphism.ml +++ /dev/null @@ -1,34 +0,0 @@ -open! Base - -type ('a, _, 'b) t = 'a * 'b - -and u = (string, int, float) t [@@deriving_inline sexp_grammar] - -let _ = fun (_ : ('a, _, 'b) t) -> () -let _ = fun (_ : u) -> () - -let (t_sexp_grammar : - 'a Sexplib0.Sexp_grammar.t - -> 'b__001_ Sexplib0.Sexp_grammar.t - -> 'b Sexplib0.Sexp_grammar.t - -> ('a, 'b__001_, 'b) t Sexplib0.Sexp_grammar.t) - = - fun _'a_sexp_grammar _'b__001__sexp_grammar _'b_sexp_grammar -> - { untyped = - List (Cons (_'a_sexp_grammar.untyped, Cons (_'b_sexp_grammar.untyped, Empty))) - } -;; - -let _ = t_sexp_grammar - -let (u_sexp_grammar : u Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy - (lazy - (t_sexp_grammar string_sexp_grammar int_sexp_grammar float_sexp_grammar).untyped) - } -;; - -let _ = u_sexp_grammar - -[@@@end] diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_polymorphism.mli b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_polymorphism.mli deleted file mode 100644 index 74bb7298..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_polymorphism.mli +++ /dev/null @@ -1 +0,0 @@ -(*_ This signature is deliberately empty. *) diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_recursive_groups.ml b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_recursive_groups.ml deleted file mode 100644 index dab3afe8..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_recursive_groups.ml +++ /dev/null @@ -1,116 +0,0 @@ -open Base - -[@@@warning "-37"] - -module _ = struct - type t = T of int [@@deriving_inline sexp_grammar] - - let _ = fun (_ : t) -> () - - let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy - (lazy - (Variant - { case_sensitivity = Case_sensitive_except_first_character - ; clauses = - [ No_tag - { name = "T" - ; clause_kind = - List_clause { args = Cons (int_sexp_grammar.untyped, Empty) } - } - ] - })) - } - ;; - - let _ = t_sexp_grammar - - [@@@end] -end - -module _ = struct - type t = - | T_int of int - | T_u of u - - and u = - | U_int of int - | U_t of t - [@@deriving_inline sexp_grammar] - - let _ = fun (_ : t) -> () - let _ = fun (_ : u) -> () - - include struct - open struct - let (grammars__001_ : Sexplib0.Sexp_grammar.defn Stdlib.List.t Stdlib.Lazy.t) = - lazy - (let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = - { untyped = Tycon ("t", []) } - and (u_sexp_grammar : u Sexplib0.Sexp_grammar.t) = - { untyped = Tycon ("u", []) } - in - [ { tycon = "t" - ; tyvars = [] - ; grammar = - Variant - { case_sensitivity = Case_sensitive_except_first_character - ; clauses = - [ No_tag - { name = "T_int" - ; clause_kind = - List_clause - { args = Cons (int_sexp_grammar.untyped, Empty) } - } - ; No_tag - { name = "T_u" - ; clause_kind = - List_clause { args = Cons (u_sexp_grammar.untyped, Empty) } - } - ] - } - } - ; { tycon = "u" - ; tyvars = [] - ; grammar = - Variant - { case_sensitivity = Case_sensitive_except_first_character - ; clauses = - [ No_tag - { name = "U_int" - ; clause_kind = - List_clause - { args = Cons (int_sexp_grammar.untyped, Empty) } - } - ; No_tag - { name = "U_t" - ; clause_kind = - List_clause { args = Cons (t_sexp_grammar.untyped, Empty) } - } - ] - } - } - ]) - ;; - - let _ = grammars__001_ - end - - let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy (lazy (Recursive (Tycon ("t", []), Stdlib.Lazy.force grammars__001_))) - } - - and (u_sexp_grammar : u Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy (lazy (Recursive (Tycon ("u", []), Stdlib.Lazy.force grammars__001_))) - } - ;; - - let _ = t_sexp_grammar - and _ = u_sexp_grammar - end - - [@@@end] -end diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_recursive_groups.mli b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_recursive_groups.mli deleted file mode 100644 index 74bb7298..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_recursive_groups.mli +++ /dev/null @@ -1 +0,0 @@ -(*_ This signature is deliberately empty. *) diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_regular_variants.ml b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_regular_variants.ml deleted file mode 100644 index ba762973..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_regular_variants.ml +++ /dev/null @@ -1,159 +0,0 @@ -open Base - -[@@@warning "-37"] - -module _ = struct - type 'a t = - | A - | B - [@@deriving_inline sexp_grammar] - - let _ = fun (_ : 'a t) -> () - - let (t_sexp_grammar : 'a Sexplib0.Sexp_grammar.t -> 'a t Sexplib0.Sexp_grammar.t) = - fun _'a_sexp_grammar -> - { untyped = - Variant - { case_sensitivity = Case_sensitive_except_first_character - ; clauses = - [ No_tag { name = "A"; clause_kind = Atom_clause } - ; No_tag { name = "B"; clause_kind = Atom_clause } - ] - } - } - ;; - - let _ = t_sexp_grammar - - [@@@end] -end - -module _ = struct - module With_sexp = struct - type t = - | A of int * int - | B of string - [@@deriving sexp_of] - end - - type t = With_sexp.t = - | A of int * int - | B of string - [@@deriving_inline sexp_grammar] - - let _ = fun (_ : t) -> () - - let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy - (lazy - (Variant - { case_sensitivity = Case_sensitive_except_first_character - ; clauses = - [ No_tag - { name = "A" - ; clause_kind = - List_clause - { args = - Cons - ( int_sexp_grammar.untyped - , Cons (int_sexp_grammar.untyped, Empty) ) - } - } - ; No_tag - { name = "B" - ; clause_kind = - List_clause - { args = Cons (string_sexp_grammar.untyped, Empty) } - } - ] - })) - } - ;; - - let _ = t_sexp_grammar - - [@@@end] - - open Expect_test_helpers_base - - let%expect_test _ = - print_s (With_sexp.sexp_of_t (A (1, 2))); - print_s (With_sexp.sexp_of_t (B "foo")); - [%expect {| - (A 1 2) - (B foo) |}] - ;; -end - -module _ = struct - module With_sexp = struct - type t = - | Int of int - | List of int list - | Sexp_dot_list of int list [@sexp.list] - [@@deriving sexp] - end - - type t = With_sexp.t = - | Int of int - | List of int list - | Sexp_dot_list of int list [@sexp.list] - [@@deriving_inline sexp_grammar] - - let _ = fun (_ : t) -> () - - let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy - (lazy - (Variant - { case_sensitivity = Case_sensitive_except_first_character - ; clauses = - [ No_tag - { name = "Int" - ; clause_kind = - List_clause { args = Cons (int_sexp_grammar.untyped, Empty) } - } - ; No_tag - { name = "List" - ; clause_kind = - List_clause - { args = - Cons ((list_sexp_grammar int_sexp_grammar).untyped, Empty) - } - } - ; No_tag - { name = "Sexp_dot_list" - ; clause_kind = - List_clause { args = Many int_sexp_grammar.untyped } - } - ] - })) - } - ;; - - let _ = t_sexp_grammar - - [@@@end] - - let (T : (With_sexp.t, t) Type_equal.t) = T - - open Expect_test_helpers_base - - let%expect_test _ = - print_s (With_sexp.sexp_of_t (Int 1)); - List.iter [ []; [ 1 ]; [ 1; 2 ] ] ~f:(fun l -> - print_s (With_sexp.sexp_of_t (List l)); - print_s (With_sexp.sexp_of_t (Sexp_dot_list l))); - [%expect - {| - (Int 1) - (List ()) - (Sexp_dot_list) - (List (1)) - (Sexp_dot_list 1) - (List (1 2)) - (Sexp_dot_list 1 2) |}] - ;; -end diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_regular_variants.mli b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_regular_variants.mli deleted file mode 100644 index 74bb7298..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_regular_variants.mli +++ /dev/null @@ -1 +0,0 @@ -(*_ This signature is deliberately empty. *) diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_tags.ml b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_tags.ml deleted file mode 100644 index b2fabc00..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_tags.ml +++ /dev/null @@ -1,387 +0,0 @@ -open Base - -module _ = struct - module type S = sig - type t [@@deriving sexp_grammar] - end - - let show_grammar (module M : S) = - Expect_test_helpers_base.print_s ([%sexp_of: _ Sexp_grammar.t] [%sexp_grammar: M.t]) - ;; - - let%expect_test "basic" = - show_grammar - (module struct - type nonrec t = (unit[@tag "key" = Atom "value"]) [@@deriving sexp_grammar] - end); - [%expect - {| - (Tagged ( - (key key) - (value value) - (grammar (List Empty)))) |}] - ;; - - let%expect_test "tag ordering" = - show_grammar - (module struct - type nonrec t = - (unit - [@tag - "key1" = Atom "value1"; - "key2" = Atom "value2"]) - [@@deriving sexp_grammar] - end); - [%expect - {| - (Tagged ( - (key key1) - (value value1) - (grammar ( - Tagged ( - (key key2) - (value value2) - (grammar (List Empty))))))) |}] - ;; - - let%expect_test "tag idents/expressions" = - show_grammar - (module struct - let k = "key" - let v = Sexp.Atom "value" - let kf () = k - let vf () = v - - type nonrec t = - (unit - [@tag - k = v; - kf () = vf ()]) - [@@deriving sexp_grammar] - end); - [%expect - {| - (Tagged ( - (key key) - (value value) - (grammar ( - Tagged ( - (key key) - (value value) - (grammar (List Empty))))))) |}] - ;; - - let%expect_test "tag nesting" = - show_grammar - (module struct - type nonrec t' = (unit[@sexp_grammar.tag "inner" = Atom "inner value"]) - [@@deriving sexp_grammar] - - type nonrec t = (t'[@sexp_grammar.tag "outer" = Atom "outer value"]) - [@@deriving sexp_grammar] - end); - [%expect - {| - (Tagged ( - (key outer) - (value "outer value") - (grammar ( - Tagged ( - (key inner) - (value "inner value") - (grammar (List Empty))))))) |}] - ;; - - let%expect_test "doc comments - variant clauses" = - show_grammar - (module struct - [@@@ocaml.warning "-37"] - - (** IGNORED *) - type t = - | Clause0 of (unit[@tag "k0" = Atom "v0"]) (** first clause *) - | Clause1 [@tag "k1" = Atom "v1"] (** second clause *) - [@@deriving sexp_grammar ~tags_of_doc_comments] - (** IGNORED *) - end); - [%expect - {| - (Variant ( - (case_sensitivity Case_sensitive_except_first_character) - (clauses ( - (Tag ( - (key sexp_grammar.doc_comment) - (value " first clause ") - (grammar ( - No_tag ( - (name Clause0) - (clause_kind ( - List_clause ( - args ( - Cons - (Tagged ( - (key k0) - (value v0) - (grammar (List Empty)))) - Empty))))))))) - (Tag ( - (key sexp_grammar.doc_comment) - (value " second clause ") - (grammar ( - Tag ( - (key k1) - (value v1) - (grammar ( - No_tag ( - (name Clause1) - (clause_kind Atom_clause))))))))))))) |}] - ;; - - let%expect_test "doc comments - poly variant clauses" = - show_grammar - (module struct - [@@@ocaml.warning "-37"] - - (** IGNORED *) - type t = - ([ `Clause0 of (unit[@tag "k0" = Atom "v0"]) (** first clause *) - | `Clause1 [@tag "k1" = Atom "v1"] (** second clause *) - ] - [@tag "kouter" = Atom "vouter"]) - [@@deriving sexp_grammar ~tags_of_doc_comments] - (** IGNORED *) - end); - [%expect - {| - (Tagged ( - (key kouter) - (value vouter) - (grammar ( - Variant ( - (case_sensitivity Case_sensitive) - (clauses ( - (Tag ( - (key sexp_grammar.doc_comment) - (value " first clause ") - (grammar ( - No_tag ( - (name Clause0) - (clause_kind ( - List_clause ( - args ( - Cons - (Tagged ( - (key k0) - (value v0) - (grammar (List Empty)))) - Empty))))))))) - (Tag ( - (key sexp_grammar.doc_comment) - (value " second clause ") - (grammar ( - Tag ( - (key k1) - (value v1) - (grammar ( - No_tag ( - (name Clause1) - (clause_kind Atom_clause)))))))))))))))) |}] - ;; - - let%expect_test "doc comments - record fields" = - show_grammar - (module struct - (** IGNORED *) - type t = - { field0 : (unit[@tag "k0" = Atom "v0"]) (** first field *) - ; field1 : unit [@tag "k1" = Atom "v1"] (** second field *) - } - [@@deriving sexp_grammar ~tags_of_doc_comments] - (** IGNORED *) - end); - [%expect - {| - (List ( - Fields ( - (allow_extra_fields false) - (fields ( - (Tag ( - (key sexp_grammar.doc_comment) - (value " first field ") - (grammar ( - No_tag ( - (name field0) - (required true) - (args ( - Cons - (Tagged ( - (key k0) - (value v0) - (grammar (List Empty)))) - Empty))))))) - (Tag ( - (key sexp_grammar.doc_comment) - (value " second field ") - (grammar ( - Tag ( - (key k1) - (value v1) - (grammar ( - No_tag ( - (name field1) - (required true) - (args (Cons (List Empty) Empty))))))))))))))) |}] - ;; - - let%expect_test "deriving sexp_grammar without tags_of_doc_comments" = - show_grammar - (module struct - type t = { field : unit (** IGNORED *) } [@@deriving sexp_grammar] - end); - [%expect - {| - (List ( - Fields ( - (allow_extra_fields false) - (fields (( - No_tag ( - (name field) - (required true) - (args (Cons (List Empty) Empty))))))))) |}] - ;; - - let%expect_test "doc comments on subexpressions" = - show_grammar - (module struct - [@@@ocaml.warning "-37"] - - type t = Foo of { bar : int (** inner *) } (** outer *) - [@@deriving sexp_grammar ~tags_of_doc_comments] - end); - [%expect - {| - (Variant ( - (case_sensitivity Case_sensitive_except_first_character) - (clauses (( - Tag ( - (key sexp_grammar.doc_comment) - (value " outer ") - (grammar ( - No_tag ( - (name Foo) - (clause_kind ( - List_clause ( - args ( - Fields ( - (allow_extra_fields false) - (fields (( - Tag ( - (key sexp_grammar.doc_comment) - (value " inner ") - (grammar ( - No_tag ( - (name bar) - (required true) - (args (Cons Integer Empty))))))))))))))))))))))) |}]; - show_grammar - (module struct - [@@@ocaml.warning "-37"] - - type t = [ `A of [ `B (** inner *) ] (** outer *) ] - [@@deriving sexp_grammar ~tags_of_doc_comments] - end); - [%expect - {| - (Variant ( - (case_sensitivity Case_sensitive) - (clauses (( - Tag ( - (key sexp_grammar.doc_comment) - (value " outer ") - (grammar ( - No_tag ( - (name A) - (clause_kind ( - List_clause ( - args ( - Cons - (Variant ( - (case_sensitivity Case_sensitive) - (clauses (( - Tag ( - (key sexp_grammar.doc_comment) - (value " inner ") - (grammar ( - No_tag ( - (name B) - (clause_kind Atom_clause)))))))))) - Empty))))))))))))) |}]; - show_grammar - (module struct - [@@@ocaml.warning "-37"] - - type t = { a : [ `B of int (** inner *) ] (** outer *) } - [@@deriving sexp_grammar ~tags_of_doc_comments] - end); - [%expect - {| - (List ( - Fields ( - (allow_extra_fields false) - (fields (( - Tag ( - (key sexp_grammar.doc_comment) - (value " outer ") - (grammar ( - No_tag ( - (name a) - (required true) - (args ( - Cons - (Variant ( - (case_sensitivity Case_sensitive) - (clauses (( - Tag ( - (key sexp_grammar.doc_comment) - (value " inner ") - (grammar ( - No_tag ( - (name B) - (clause_kind (List_clause (args (Cons Integer Empty))))))))))))) - Empty)))))))))))) |}]; - show_grammar - (module struct - [@@@ocaml.warning "-37"] - - type t = [ `A of [ `B (** inner *) ] option (** outer *) ] - [@@deriving sexp_grammar ~tags_of_doc_comments] - end); - [%expect - {| - (Variant ( - (case_sensitivity Case_sensitive) - (clauses (( - Tag ( - (key sexp_grammar.doc_comment) - (value " outer ") - (grammar ( - No_tag ( - (name A) - (clause_kind ( - List_clause ( - args ( - Cons - (Option ( - Variant ( - (case_sensitivity Case_sensitive) - (clauses (( - Tag ( - (key sexp_grammar.doc_comment) - (value " inner ") - (grammar ( - No_tag ( - (name B) - (clause_kind Atom_clause))))))))))) - Empty))))))))))))) |}] - ;; -end diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_tags.mli b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_tags.mli deleted file mode 100644 index d0dde5e1..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_tags.mli +++ /dev/null @@ -1 +0,0 @@ -(* This interface intentionally left empty. *) diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_tags.mlt b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_tags.mlt deleted file mode 100644 index 6c83f45c..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_tags.mlt +++ /dev/null @@ -1,61 +0,0 @@ -open Ppx_sexp_conv_lib -open Conv;; - -#verbose true - -module No_keys = struct - type t = (unit[@sexp_grammar.tag]) [@@deriving sexp_grammar] -end - -[%%expect {| -Line _, characters _-_: -Error: :: expected -|}] - -module Key_literal_is_not_string = struct - type t = (unit[@sexp_grammar.tag 1 = [%sexp ""]]) [@@deriving sexp_grammar] -end - -[%%expect - {| -Line _, characters _-_: -Error: This expression has type int but an expression was expected of type - string -|}] - -module Key_ident_is_not_string = struct - let k = 1 - - type t = (unit[@sexp_grammar.tag k = [%sexp ""]]) [@@deriving sexp_grammar] -end - -[%%expect - {| -Line _, characters _-_: -Error: This expression has type int but an expression was expected of type - string -|}] - -module Value_literal_is_not_sexp = struct - type t = (unit[@sexp_grammar.tag "key" = 1]) [@@deriving sexp_grammar] -end - -[%%expect - {| -Line _, characters _-_: -Error: This expression has type int but an expression was expected of type - Sexp.t -|}] - -module Value_ident_is_not_sexp = struct - let v = 1 - - type t = (unit[@sexp_grammar.tag "key" = v]) [@@deriving sexp_grammar] -end - -[%%expect - {| -Line _, characters _-_: -Error: This expression has type int but an expression was expected of type - Sexp.t -|}] diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_test.ml b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_test.ml deleted file mode 100644 index d09ce3b7..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_test.ml +++ /dev/null @@ -1,86 +0,0 @@ -open! Base - -module _ = struct - type t = int [@@deriving_inline sexp_grammar] - - let _ = fun (_ : t) -> () - let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = int_sexp_grammar - let _ = t_sexp_grammar - - [@@@deriving.end] -end - -module _ = struct - type 'a t = T of 'a - - and 'a u = U of 'a t option [@@deriving_inline sexp_grammar] - - let _ = fun (_ : 'a t) -> () - let _ = fun (_ : 'a u) -> () - - let (t_sexp_grammar : 'a Sexplib0.Sexp_grammar.t -> 'a t Sexplib0.Sexp_grammar.t) = - fun _'a_sexp_grammar -> - { untyped = - Variant - { case_sensitivity = Case_sensitive_except_first_character - ; clauses = - [ No_tag - { name = "T" - ; clause_kind = - List_clause { args = Cons (_'a_sexp_grammar.untyped, Empty) } - } - ] - } - } - ;; - - let _ = t_sexp_grammar - - let (u_sexp_grammar : 'a Sexplib0.Sexp_grammar.t -> 'a u Sexplib0.Sexp_grammar.t) = - fun _'a_sexp_grammar -> - { untyped = - Variant - { case_sensitivity = Case_sensitive_except_first_character - ; clauses = - [ No_tag - { name = "U" - ; clause_kind = - List_clause - { args = - Cons - ( (option_sexp_grammar (t_sexp_grammar _'a_sexp_grammar)) - .untyped - , Empty ) - } - } - ] - } - } - ;; - - let _ = u_sexp_grammar - - [@@@deriving.end] - - (* Avoid unused constructor warnings. *) - let _ = T () - let _ = U None -end - -module _ = struct - type ('a, 'b) t = 'a -> 'b [@@deriving_inline sexp_grammar] - - let _ = fun (_ : ('a, 'b) t) -> () - - let (t_sexp_grammar : - 'a Sexplib0.Sexp_grammar.t - -> 'b Sexplib0.Sexp_grammar.t - -> ('a, 'b) t Sexplib0.Sexp_grammar.t) - = - fun _'a_sexp_grammar _'b_sexp_grammar -> Sexplib0.Sexp_conv.fun_sexp_grammar - ;; - - let _ = t_sexp_grammar - - [@@@end] -end diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_test.mli b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_test.mli deleted file mode 100644 index 74bb7298..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_test.mli +++ /dev/null @@ -1 +0,0 @@ -(*_ This signature is deliberately empty. *) diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_variants_more.ml b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_variants_more.ml deleted file mode 100644 index 9658d8b5..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_variants_more.ml +++ /dev/null @@ -1,93 +0,0 @@ -open Base - -[@@@warning "-37"] - -module _ = struct - type t = A of [ `A of int ] [@@deriving_inline sexp_grammar] - - let _ = fun (_ : t) -> () - - let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy - (lazy - (Variant - { case_sensitivity = Case_sensitive_except_first_character - ; clauses = - [ No_tag - { name = "A" - ; clause_kind = - List_clause - { args = - Cons - ( Variant - { case_sensitivity = Case_sensitive - ; clauses = - [ No_tag - { name = "A" - ; clause_kind = - List_clause - { args = - Cons - ( int_sexp_grammar.untyped - , Empty ) - } - } - ] - } - , Empty ) - } - } - ] - })) - } - ;; - - let _ = t_sexp_grammar - - [@@@end] -end - -module _ = struct - type t = { a : [ `A of int ] } [@@deriving_inline sexp_grammar] - - let _ = fun (_ : t) -> () - - let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = - { untyped = - Lazy - (lazy - (List - (Fields - { allow_extra_fields = false - ; fields = - [ No_tag - { name = "a" - ; required = true - ; args = - Cons - ( Variant - { case_sensitivity = Case_sensitive - ; clauses = - [ No_tag - { name = "A" - ; clause_kind = - List_clause - { args = - Cons - (int_sexp_grammar.untyped, Empty) - } - } - ] - } - , Empty ) - } - ] - }))) - } - ;; - - let _ = t_sexp_grammar - - [@@@end] -end diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_variants_more.mli b/bench/vendored/ppx_sexp_conv.v0.15.1/test/sexp_grammar/test_variants_more.mli deleted file mode 100644 index e69de29b..00000000 diff --git a/bench/vendored/ppx_sexp_conv.v0.15.1/test/test.sexp b/bench/vendored/ppx_sexp_conv.v0.15.1/test/test.sexp deleted file mode 100644 index ec1bf532..00000000 --- a/bench/vendored/ppx_sexp_conv.v0.15.1/test/test.sexp +++ /dev/null @@ -1,34 +0,0 @@ -(this is a list) - -(this is another list and (this is a nested list)) - -( - "\ - This is a multi-line \ - string with embedded - - newlines." - - "This string contains decimal \255, hex \xff codes, \ - and other \\ \n escapes." - - A# # ## #x| -) - -; Line comment - -#; ( - S-expression comment -) - -#| #| Nested |# block comment "|#" |# - -#| "" |# -#| ""|# -#|"" |# -#|""|# - -#| "asdf" "asdf" |# - -(something #| ; |# () "something else") -