From 9a032ba70a40c05220c72b1703035b21f03ee1a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20Gro=C3=9Fe?= Date: Mon, 30 Sep 2024 21:29:13 +0200 Subject: [PATCH] test: promote new derive changes --- derive/common.t/run.t | 23 +- derive/records.t/run.t | 115 +++-- derive/variants.t/run.t | 434 +++++++++--------- .../variant_adjacently_tagged_test.ml | 4 +- .../variant_externally_tagged_test.ml | 2 - .../variant_internally_tagged_test.ml | 4 +- 6 files changed, 271 insertions(+), 311 deletions(-) diff --git a/derive/common.t/run.t b/derive/common.t/run.t index 4656a54..5599bab 100644 --- a/derive/common.t/run.t +++ b/derive/common.t/run.t @@ -35,7 +35,8 @@ { tool_name = "ppx_driver"; include_dirs = []; - load_path = []; + hidden_include_dirs = []; + load_path = ([], []); open_modules = []; for_package = None; debug = false; @@ -52,16 +53,14 @@ include struct let _ = fun (_ : numbers) -> () - let ( let* ) = Result.bind - let _ = ( let* ) let serialize_numbers = - let open Serde.Ser in fun t -> fun ctx -> (s (list int)) t ctx + let ( let* ) = Stdlib.Result.bind in + let _ = ( let* ) in + let open Serde.Ser in fun t ctx -> (s (list int)) t ctx let _ = serialize_numbers open! Serde - let ( let* ) = Result.bind - let _ = ( let* ) let deserialize_numbers = - let ( let* ) = Result.bind in + let ( let* ) = Stdlib.Result.bind in let _ = ( let* ) in let open Serde.De in fun ctx -> (d (list int)) ctx let _ = deserialize_numbers end[@@ocaml.doc "@inline"][@@merlin.hide ] @@ -69,17 +68,15 @@ include struct let _ = fun (_ : number_list_list) -> () - let ( let* ) = Result.bind - let _ = ( let* ) let serialize_number_list_list = + let ( let* ) = Stdlib.Result.bind in + let _ = ( let* ) in let open Serde.Ser in - fun t -> fun ctx -> (s (array (s serialize_numbers))) t ctx + fun t ctx -> (s (array (s serialize_numbers))) t ctx let _ = serialize_number_list_list open! Serde - let ( let* ) = Result.bind - let _ = ( let* ) let deserialize_number_list_list = - let ( let* ) = Result.bind in + let ( let* ) = Stdlib.Result.bind in let _ = ( let* ) in let open Serde.De in fun ctx -> (d (array (d deserialize_numbers))) ctx let _ = deserialize_number_list_list diff --git a/derive/records.t/run.t b/derive/records.t/run.t index 6b6b5ab..d5825e6 100644 --- a/derive/records.t/run.t +++ b/derive/records.t/run.t @@ -79,7 +79,8 @@ { tool_name = "ppx_driver"; include_dirs = []; - load_path = []; + hidden_include_dirs = []; + load_path = ([], []); open_modules = []; for_package = None; debug = false; @@ -98,25 +99,22 @@ include struct let _ = fun (_ : rank) -> () - let ( let* ) = Result.bind - let _ = ( let* ) let serialize_rank = + let ( let* ) = Stdlib.Result.bind in + let _ = ( let* ) in let open Serde.Ser in - fun t -> - fun ctx -> - record ctx "rank" 2 - (fun ctx -> - let* () = - field ctx "rank_scores" ((s (list string)) t.rank_scores) - in - let* () = field ctx "rank_name" (string t.rank_name) - in Ok ()) + fun t ctx -> + record ctx "rank" 2 + (fun ctx -> + let* () = + field ctx "rank_scores" ((s (list string)) t.rank_scores) + in + let* () = field ctx "rank_name" (string t.rank_name) + in Ok ()) let _ = serialize_rank open! Serde - let ( let* ) = Result.bind - let _ = ( let* ) let deserialize_rank = - let ( let* ) = Result.bind in + let ( let* ) = Stdlib.Result.bind in let _ = ( let* ) in let open Serde.De in fun ctx -> @@ -153,13 +151,13 @@ let* () = read_fields () in let* rank_scores = - Option.to_result + Stdlib.Option.to_result ~none:(`Msg "missing field \"rank_scores\" (\"rank_scores\")") (!rank_scores) in let* rank_name = - Option.to_result + Stdlib.Option.to_result ~none:(`Msg "missing field \"rank_name\" (\"rank_name\")") (!rank_name) in Ok { rank_name; rank_scores }) @@ -179,36 +177,32 @@ include struct let _ = fun (_ : t) -> () - let ( let* ) = Result.bind - let _ = ( let* ) let serialize_t = + let ( let* ) = Stdlib.Result.bind in + let _ = ( let* ) in let open Serde.Ser in - fun t -> - fun ctx -> - record ctx "t" 8 - (fun ctx -> - let* () = field ctx "name" (string t.name) - in - let* () = field ctx "commisioned" (bool t.commisioned) - in - let* () = field ctx "updated_at" (int64 t.updated_at) - in - let* () = field ctx "credits" ((s (option int32)) t.credits) - in - let* () = - field ctx "keywords" ((s (array string)) t.keywords) - in - let* () = field ctx "rank" ((s serialize_rank) t.rank) - in - let* () = field ctx "value" (float t.value) - in let* () = field ctx "type" (string t.type_) - in Ok ()) + fun t ctx -> + record ctx "t" 8 + (fun ctx -> + let* () = field ctx "name" (string t.name) + in + let* () = field ctx "commisioned" (bool t.commisioned) + in + let* () = field ctx "updated_at" (int64 t.updated_at) + in + let* () = field ctx "credits" ((s (option int32)) t.credits) + in + let* () = field ctx "keywords" ((s (array string)) t.keywords) + in + let* () = field ctx "rank" ((s serialize_rank) t.rank) + in + let* () = field ctx "value" (float t.value) + in let* () = field ctx "type" (string t.type_) + in Ok ()) let _ = serialize_t open! Serde - let ( let* ) = Result.bind - let _ = ( let* ) let deserialize_t = - let ( let* ) = Result.bind in + let ( let* ) = Stdlib.Result.bind in let _ = ( let* ) in let open Serde.De in fun ctx -> @@ -281,18 +275,18 @@ let* () = read_fields () in let* name = - Option.to_result + Stdlib.Option.to_result ~none:(`Msg "missing field \"name\" (\"name\")") ( !name) in let* commisioned = - Option.to_result + Stdlib.Option.to_result ~none:(`Msg "missing field \"commisioned\" (\"commisioned\")") (!commisioned) in let* updated_at = - Option.to_result + Stdlib.Option.to_result ~none:(`Msg "missing field \"updated_at\" (\"updated_at\")") (!updated_at) @@ -300,22 +294,22 @@ let credits = match !credits with | Some opt -> opt | None -> None in let* keywords = - Option.to_result + Stdlib.Option.to_result ~none:(`Msg "missing field \"keywords\" (\"keywords\")") (!keywords) in let* rank = - Option.to_result + Stdlib.Option.to_result ~none:(`Msg "missing field \"rank\" (\"rank\")") ( !rank) in let* value = - Option.to_result + Stdlib.Option.to_result ~none:(`Msg "missing field \"value\" (\"value\")") (!value) in let* type_ = - Option.to_result + Stdlib.Option.to_result ~none:(`Msg "missing field \"type\" (\"type_\")") ( !type_) in @@ -337,23 +331,20 @@ include struct let _ = fun (_ : t_list) -> () - let ( let* ) = Result.bind - let _ = ( let* ) let serialize_t_list = + let ( let* ) = Stdlib.Result.bind in + let _ = ( let* ) in let open Serde.Ser in - fun t -> - fun ctx -> - record ctx "t_list" 1 - (fun ctx -> - let* () = - field ctx "stuff" ((s (list (s serialize_t))) t.stuff) - in Ok ()) + fun t ctx -> + record ctx "t_list" 1 + (fun ctx -> + let* () = + field ctx "stuff" ((s (list (s serialize_t))) t.stuff) + in Ok ()) let _ = serialize_t_list open! Serde - let ( let* ) = Result.bind - let _ = ( let* ) let deserialize_t_list = - let ( let* ) = Result.bind in + let ( let* ) = Stdlib.Result.bind in let _ = ( let* ) in let open Serde.De in fun ctx -> @@ -382,7 +373,7 @@ let* () = read_fields () in let* stuff = - Option.to_result + Stdlib.Option.to_result ~none:(`Msg "missing field \"stuff\" (\"stuff\")") (!stuff) in Ok { stuff }) diff --git a/derive/variants.t/run.t b/derive/variants.t/run.t index d445e66..060c14a 100644 --- a/derive/variants.t/run.t +++ b/derive/variants.t/run.t @@ -63,7 +63,8 @@ $ externally tagged variant { tool_name = "ppx_driver"; include_dirs = []; - load_path = []; + hidden_include_dirs = []; + load_path = ([], []); open_modules = []; for_package = None; debug = false; @@ -76,7 +77,6 @@ $ externally tagged variant unsafe_string = false; cookies = [] }] - [@@@warning "-37"] type rank = | Captain of { name: string ; @@ -87,49 +87,45 @@ $ externally tagged variant include struct let _ = fun (_ : rank) -> () - let ( let* ) = Result.bind - let _ = ( let* ) let serialize_rank = + let ( let* ) = Stdlib.Result.bind in + let _ = ( let* ) in let open Serde.Ser in - fun t -> - fun ctx -> - match t with - | Captain r -> - record_variant ctx "rank" 0 "Captain" 2 - (fun ctx -> - let* () = field ctx "name" (string r.name) - in let* () = field ctx "ship" (string r.ship) - in Ok ()) - | Commander (v_1, v_2, v_3) -> - tuple_variant ctx "rank" 1 "Commander" 3 - (fun ctx -> - let* () = element ctx (string v_1) - in - let* () = element ctx (int32 v_2) - in let* () = element ctx (float v_3) - in Ok ()) - | Lt v_1 -> - newtype_variant ctx "rank" 2 "Lt" ((s (option bool)) v_1) - | Ensign -> unit_variant ctx "rank" 3 "Ensign" + fun t ctx -> + match t with + | Captain r -> + record_variant ctx "rank" 0 "Captain" 2 + (fun ctx -> + let* () = field ctx "name" (string r.name) + in let* () = field ctx "ship" (string r.ship) + in Ok ()) + | Commander (v_1, v_2, v_3) -> + tuple_variant ctx "rank" 1 "Commander" 3 + (fun ctx -> + let* () = element ctx (string v_1) + in + let* () = element ctx (int32 v_2) + in let* () = element ctx (float v_3) + in Ok ()) + | Lt v_1 -> + newtype_variant ctx "rank" 2 "Lt" ((s (option bool)) v_1) + | Ensign -> unit_variant ctx "rank" 3 "Ensign" let _ = serialize_rank open! Serde - let ( let* ) = Result.bind - let _ = ( let* ) let deserialize_rank = - let ( let* ) = Result.bind in + let ( let* ) = Stdlib.Result.bind in let _ = ( let* ) in let open Serde.De in fun ctx -> let field_visitor = Visitor.make - ~visit_string:(fun _ctx -> - fun str -> - match str with - | "Captain" -> Ok `Captain - | "Commander" -> Ok `Commander - | "Lt" -> Ok `Lt - | "Ensign" -> Ok `Ensign - | _ -> Error `invalid_tag) () in + ~visit_string:(fun _ctx str -> + match str with + | "Captain" -> Ok `Captain + | "Commander" -> Ok `Commander + | "Lt" -> Ok `Lt + | "Ensign" -> Ok `Ensign + | _ -> Error `invalid_tag) () in (variant ctx "rank" ["Captain"; "Commander"; "Lt"; "Ensign"]) @@ (fun ctx -> let* tag = identifier ctx field_visitor @@ -137,74 +133,70 @@ $ externally tagged variant match tag with | `Captain -> record_variant ctx 2 - (fun ~size -> - fun ctx -> - ignore size; - (let field_visitor = - let visit_string _ctx str = - match str with - | "ship" -> Ok `ship - | "name" -> Ok `name - | _ -> Ok `invalid_tag in - let visit_int _ctx str = - match str with - | 0 -> Ok `ship - | 1 -> Ok `name - | _ -> Ok `invalid_tag in - Visitor.make ~visit_string ~visit_int () in - let name = ref None in - let ship = ref None in - let rec read_fields () = - let* tag = next_field ctx field_visitor - in - match tag with - | Some `ship -> - let* v = field ctx "ship" string - in (ship := (Some v); read_fields ()) - | Some `name -> - let* v = field ctx "name" string - in (name := (Some v); read_fields ()) - | Some `invalid_tag -> - let* () = ignore_any ctx - in read_fields () - | None -> Ok () in - let* () = read_fields () - in - let* name = - Option.to_result - ~none:(`Msg - "missing field \"name\" (\"name\")") - (!name) + (fun ~size ctx -> + ignore size; + (let field_visitor = + let visit_string _ctx str = + match str with + | "ship" -> Ok `ship + | "name" -> Ok `name + | _ -> Ok `invalid_tag in + let visit_int _ctx str = + match str with + | 0 -> Ok `ship + | 1 -> Ok `name + | _ -> Ok `invalid_tag in + Visitor.make ~visit_string ~visit_int () in + let name = ref None in + let ship = ref None in + let rec read_fields () = + let* tag = next_field ctx field_visitor in - let* ship = - Option.to_result - ~none:(`Msg - "missing field \"ship\" (\"ship\")") - (!ship) - in Ok (Captain { ship; name }))) + match tag with + | Some `ship -> + let* v = field ctx "ship" string + in (ship := (Some v); read_fields ()) + | Some `name -> + let* v = field ctx "name" string + in (name := (Some v); read_fields ()) + | Some `invalid_tag -> + let* () = ignore_any ctx + in read_fields () + | None -> Ok () in + let* () = read_fields () + in + let* name = + Stdlib.Option.to_result + ~none:(`Msg "missing field \"name\" (\"name\")") + (!name) + in + let* ship = + Stdlib.Option.to_result + ~none:(`Msg "missing field \"ship\" (\"ship\")") + (!ship) + in Ok (Captain { ship; name }))) | `Commander -> tuple_variant ctx 3 - (fun ~size -> - fun ctx -> - ignore size; - (let* v_1 = - match element ctx string with - | Ok (Some v) -> Ok v - | Ok (None) -> Error `no_more_data - | Error reason -> Error reason - in - let* v_2 = - match element ctx int32 with - | Ok (Some v) -> Ok v - | Ok (None) -> Error `no_more_data - | Error reason -> Error reason - in - let* v_3 = - match element ctx float with - | Ok (Some v) -> Ok v - | Ok (None) -> Error `no_more_data - | Error reason -> Error reason - in Ok (Commander (v_1, v_2, v_3)))) + (fun ~size ctx -> + ignore size; + (let* v_1 = + match element ctx string with + | Ok (Some v) -> Ok v + | Ok (None) -> Error `no_more_data + | Error reason -> Error reason + in + let* v_2 = + match element ctx int32 with + | Ok (Some v) -> Ok v + | Ok (None) -> Error `no_more_data + | Error reason -> Error reason + in + let* v_3 = + match element ctx float with + | Ok (Some v) -> Ok v + | Ok (None) -> Error `no_more_data + | Error reason -> Error reason + in Ok (Commander (v_1, v_2, v_3)))) | `Lt -> (newtype_variant ctx) @@ ((fun ctx -> @@ -219,32 +211,28 @@ $ externally tagged variant include struct let _ = fun (_ : ranks) -> () - let ( let* ) = Result.bind - let _ = ( let* ) let serialize_ranks = + let ( let* ) = Stdlib.Result.bind in + let _ = ( let* ) in let open Serde.Ser in - fun t -> - fun ctx -> - match t with - | Ranks v_1 -> - newtype_variant ctx "ranks" 0 "Ranks" - ((s (list (s serialize_rank))) v_1) + fun t ctx -> + match t with + | Ranks v_1 -> + newtype_variant ctx "ranks" 0 "Ranks" + ((s (list (s serialize_rank))) v_1) let _ = serialize_ranks open! Serde - let ( let* ) = Result.bind - let _ = ( let* ) let deserialize_ranks = - let ( let* ) = Result.bind in + let ( let* ) = Stdlib.Result.bind in let _ = ( let* ) in let open Serde.De in fun ctx -> let field_visitor = Visitor.make - ~visit_string:(fun _ctx -> - fun str -> - match str with - | "Ranks" -> Ok `Ranks - | _ -> Error `invalid_tag) () in + ~visit_string:(fun _ctx str -> + match str with + | "Ranks" -> Ok `Ranks + | _ -> Error `invalid_tag) () in (variant ctx "ranks" ["Ranks"]) @@ (fun ctx -> let* tag = identifier ctx field_visitor @@ -349,7 +337,8 @@ $ adjacently tagged variant { tool_name = "ppx_driver"; include_dirs = []; - load_path = []; + hidden_include_dirs = []; + load_path = ([], []); open_modules = []; for_package = None; debug = false; @@ -362,7 +351,6 @@ $ adjacently tagged variant unsafe_string = false; cookies = [] }] - [@@@warning "-37"] type rank = | Captain of { name: string ; @@ -375,64 +363,60 @@ $ adjacently tagged variant include struct let _ = fun (_ : rank) -> () - let ( let* ) = Result.bind - let _ = ( let* ) let serialize_rank = + let ( let* ) = Stdlib.Result.bind in + let _ = ( let* ) in let open Serde.Ser in - fun t -> - fun ctx -> - match t with - | Captain r -> - record ctx "" 2 - (fun ctx -> - let* () = field ctx "t" (string "Captain") - in - field ctx "c" - (fun ctx -> - record ctx "rank" 2 - (fun ctx -> - let* () = field ctx "name" (string r.name) - in - let* () = field ctx "ship" (string r.ship) - in Ok ()))) - | Commander (v_1, v_2, v_3) -> - record ctx "" 2 - (fun ctx -> - let* () = field ctx "t" (string "Commander") - in - field ctx "c" - (fun ctx -> - sequence ctx 3 - (fun ctx -> - let* () = element ctx (string v_1) - in - let* () = element ctx (int32 v_2) - in let* () = element ctx (float v_3) - in Ok ()))) - | Lt v_1 -> - record ctx "" 2 - (fun ctx -> - let* () = field ctx "t" (string "Lt") - in field ctx "c" (fun ctx -> (s (option bool)) v_1 ctx)) - | Ensign -> - record ctx "" 1 (fun ctx -> field ctx "t" (string "Ensign")) + fun t ctx -> + match t with + | Captain r -> + record ctx "" 2 + (fun ctx -> + let* () = field ctx "t" (string "Captain") + in + field ctx "c" + (fun ctx -> + record ctx "rank" 2 + (fun ctx -> + let* () = field ctx "name" (string r.name) + in + let* () = field ctx "ship" (string r.ship) + in Ok ()))) + | Commander (v_1, v_2, v_3) -> + record ctx "" 2 + (fun ctx -> + let* () = field ctx "t" (string "Commander") + in + field ctx "c" + (fun ctx -> + sequence ctx 3 + (fun ctx -> + let* () = element ctx (string v_1) + in + let* () = element ctx (int32 v_2) + in let* () = element ctx (float v_3) + in Ok ()))) + | Lt v_1 -> + record ctx "" 2 + (fun ctx -> + let* () = field ctx "t" (string "Lt") + in field ctx "c" (fun ctx -> (s (option bool)) v_1 ctx)) + | Ensign -> + record ctx "" 1 (fun ctx -> field ctx "t" (string "Ensign")) let _ = serialize_rank open! Serde - let ( let* ) = Result.bind - let _ = ( let* ) let deserialize_rank = - let ( let* ) = Result.bind in + let ( let* ) = Stdlib.Result.bind in let _ = ( let* ) in let open Serde.De in fun ctx -> let tag_content_field_visitor = Visitor.make - ~visit_string:(fun _ctx -> - fun str -> - match str with - | "t" -> Ok `tag - | "c" -> Ok `content - | _ -> Error `invalid_tag) () in + ~visit_string:(fun _ctx str -> + match str with + | "t" -> Ok `tag + | "c" -> Ok `content + | _ -> Error `invalid_tag) () in record ctx "" 2 (fun ctx -> let rec read_fields ctx = @@ -487,40 +471,39 @@ $ adjacently tagged variant let* () = read_fields () in let* name = - Option.to_result + Stdlib.Option.to_result ~none:(`Msg "missing field \"name\" (\"name\")") (!name) in let* ship = - Option.to_result + Stdlib.Option.to_result ~none:(`Msg "missing field \"ship\" (\"ship\")") (!ship) in Ok (Captain { ship; name })) | "Commander" -> sequence ctx - (fun ~size -> - fun ctx -> - ignore size; - (let* v_1 = - match element ctx string with - | Ok (Some v) -> Ok v - | Ok (None) -> Error `no_more_data - | Error reason -> Error reason - in - let* v_2 = - match element ctx int32 with - | Ok (Some v) -> Ok v - | Ok (None) -> Error `no_more_data - | Error reason -> Error reason - in - let* v_3 = - match element ctx float with - | Ok (Some v) -> Ok v - | Ok (None) -> Error `no_more_data - | Error reason -> Error reason - in Ok (Commander (v_1, v_2, v_3)))) + (fun ~size ctx -> + ignore size; + (let* v_1 = + match element ctx string with + | Ok (Some v) -> Ok v + | Ok (None) -> Error `no_more_data + | Error reason -> Error reason + in + let* v_2 = + match element ctx int32 with + | Ok (Some v) -> Ok v + | Ok (None) -> Error `no_more_data + | Error reason -> Error reason + in + let* v_3 = + match element ctx float with + | Ok (Some v) -> Ok v + | Ok (None) -> Error `no_more_data + | Error reason -> Error reason + in Ok (Commander (v_1, v_2, v_3)))) | "Lt" -> (deserialize ctx) @@ ((fun ctx -> @@ -574,40 +557,39 @@ $ adjacently tagged variant let* () = read_fields () in let* name = - Option.to_result + Stdlib.Option.to_result ~none:(`Msg "missing field \"name\" (\"name\")") (!name) in let* ship = - Option.to_result + Stdlib.Option.to_result ~none:(`Msg "missing field \"ship\" (\"ship\")") (!ship) in Ok (Captain { ship; name })) | "Commander" -> sequence ctx - (fun ~size -> - fun ctx -> - ignore size; - (let* v_1 = - match element ctx string with - | Ok (Some v) -> Ok v - | Ok (None) -> Error `no_more_data - | Error reason -> Error reason - in - let* v_2 = - match element ctx int32 with - | Ok (Some v) -> Ok v - | Ok (None) -> Error `no_more_data - | Error reason -> Error reason - in - let* v_3 = - match element ctx float with - | Ok (Some v) -> Ok v - | Ok (None) -> Error `no_more_data - | Error reason -> Error reason - in Ok (Commander (v_1, v_2, v_3)))) + (fun ~size ctx -> + ignore size; + (let* v_1 = + match element ctx string with + | Ok (Some v) -> Ok v + | Ok (None) -> Error `no_more_data + | Error reason -> Error reason + in + let* v_2 = + match element ctx int32 with + | Ok (Some v) -> Ok v + | Ok (None) -> Error `no_more_data + | Error reason -> Error reason + in + let* v_3 = + match element ctx float with + | Ok (Some v) -> Ok v + | Ok (None) -> Error `no_more_data + | Error reason -> Error reason + in Ok (Commander (v_1, v_2, v_3)))) | "Lt" -> (deserialize ctx) @@ ((fun ctx -> @@ -634,32 +616,28 @@ $ adjacently tagged variant include struct let _ = fun (_ : ranks) -> () - let ( let* ) = Result.bind - let _ = ( let* ) let serialize_ranks = + let ( let* ) = Stdlib.Result.bind in + let _ = ( let* ) in let open Serde.Ser in - fun t -> - fun ctx -> - match t with - | Ranks v_1 -> - newtype_variant ctx "ranks" 0 "Ranks" - ((s (list (s serialize_rank))) v_1) + fun t ctx -> + match t with + | Ranks v_1 -> + newtype_variant ctx "ranks" 0 "Ranks" + ((s (list (s serialize_rank))) v_1) let _ = serialize_ranks open! Serde - let ( let* ) = Result.bind - let _ = ( let* ) let deserialize_ranks = - let ( let* ) = Result.bind in + let ( let* ) = Stdlib.Result.bind in let _ = ( let* ) in let open Serde.De in fun ctx -> let field_visitor = Visitor.make - ~visit_string:(fun _ctx -> - fun str -> - match str with - | "Ranks" -> Ok `Ranks - | _ -> Error `invalid_tag) () in + ~visit_string:(fun _ctx str -> + match str with + | "Ranks" -> Ok `Ranks + | _ -> Error `invalid_tag) () in (variant ctx "ranks" ["Ranks"]) @@ (fun ctx -> let* tag = identifier ctx field_visitor diff --git a/derive/variants.t/variant_adjacently_tagged_test.ml b/derive/variants.t/variant_adjacently_tagged_test.ml index 44825b8..c164d45 100644 --- a/derive/variants.t/variant_adjacently_tagged_test.ml +++ b/derive/variants.t/variant_adjacently_tagged_test.ml @@ -1,11 +1,9 @@ -[@@@warning "-37"] - type rank = | Captain of { name : string; ship : string } | Commander of string * int32 * float | Lt of bool option | Ensign -[@@deriving serialize, deserialize] [@@serde {tag = "t"; content = "c"}] +[@@deriving serialize, deserialize] [@@serde { tag = "t"; content = "c" }] type ranks = Ranks of rank list [@@deriving serialize, deserialize] diff --git a/derive/variants.t/variant_externally_tagged_test.ml b/derive/variants.t/variant_externally_tagged_test.ml index 1525360..009bc02 100644 --- a/derive/variants.t/variant_externally_tagged_test.ml +++ b/derive/variants.t/variant_externally_tagged_test.ml @@ -1,5 +1,3 @@ -[@@@warning "-37"] - type rank = | Captain of { name : string; ship : string } | Commander of string * int32 * float diff --git a/derive/variants.t/variant_internally_tagged_test.ml b/derive/variants.t/variant_internally_tagged_test.ml index b62e32d..db8af67 100644 --- a/derive/variants.t/variant_internally_tagged_test.ml +++ b/derive/variants.t/variant_internally_tagged_test.ml @@ -1,11 +1,9 @@ -[@@@warning "-37"] - type rank = | Captain of { name : string; ship : string } | Commander of string * int32 * float | Lt of bool option | Ensign -[@@deriving serialize, deserialize] [@@serde {tag = "t"}] +[@@deriving serialize, deserialize] [@@serde { tag = "t" }] type ranks = Ranks of rank list [@@deriving serialize, deserialize]