Skip to content

Commit 1ade989

Browse files
committed
Add a few TODOs
1 parent ee12efb commit 1ade989

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/ppx_deriving_yojson.ml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,11 @@ and desu_expr_of_only_typ ~path typ =
300300
raise_errorf ~loc:ptyp_loc "%s cannot be derived for %s"
301301
deriver (Ppx_deriving.string_of_core_type typ)
302302

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

src_test/test_ppx_yojson.ml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,22 @@ let test_int_redefined ctxt =
505505
let expected = `Int 1 in
506506
assert_equal ~ctxt ~printer:show_json expected M.x
507507

508+
(* TODO: Make this work *)
509+
(*
510+
let test_list_redefined ctxt =
511+
let module M = struct
512+
type redef_list =
513+
| []
514+
| (::) of int * int
515+
516+
type t = {field : int list} [@@deriving to_yojson]
517+
let x = {field = List.([1;2])}
518+
end
519+
in
520+
let expected = `List [`Int 1; `Int 2] in
521+
assert_equal ~ctxt ~printer:show_json expected M.x
522+
*)
523+
508524
let test_equality_redefined ctxt =
509525
let module M = struct
510526
module Pervasives = struct

0 commit comments

Comments
 (0)