Skip to content

Commit

Permalink
Add a few TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
kit-ty-kate committed Nov 7, 2020
1 parent ee12efb commit 1ade989
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ppx_deriving_yojson.ml
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ and desu_expr_of_only_typ ~path typ =
raise_errorf ~loc:ptyp_loc "%s cannot be derived for %s"
deriver (Ppx_deriving.string_of_core_type typ)

(* TODO: Do not wrap runtime around [@default ...].
We do currently and for instance the following doesn't currently work:
module List = struct let x = [1; 2] end
type t = {field : int list [@default List.x]} [@@deriving to_yojson]
*)
let wrap_runtime decls =
Ppx_deriving.sanitize ~module_:(Lident "Ppx_deriving_yojson_runtime") decls

Expand Down
16 changes: 16 additions & 0 deletions src_test/test_ppx_yojson.ml
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,22 @@ let test_int_redefined ctxt =
let expected = `Int 1 in
assert_equal ~ctxt ~printer:show_json expected M.x

(* TODO: Make this work *)
(*
let test_list_redefined ctxt =
let module M = struct
type redef_list =
| []
| (::) of int * int
type t = {field : int list} [@@deriving to_yojson]
let x = {field = List.([1;2])}
end
in
let expected = `List [`Int 1; `Int 2] in
assert_equal ~ctxt ~printer:show_json expected M.x
*)

let test_equality_redefined ctxt =
let module M = struct
module Pervasives = struct
Expand Down

0 comments on commit 1ade989

Please sign in to comment.