Skip to content

Commit

Permalink
rename functions and edit error msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
ayc9 committed Jan 7, 2022
1 parent 51efc16 commit 8aa7321
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/make/ppx_make.ml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@
=
let derived_item = create_make_fun ~loc ~ty_name ~tps label_decls in
(match private_ with
(* We can't expose functions that explicitly create private
records. *)
| Private -> []
| Private -> Location.raise_errorf ~loc "We cannot expose functions that explicitly create private records."
| Public -> [ derived_item ])
;;

Expand Down
13 changes: 13 additions & 0 deletions test/make/signature/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,16 @@ Test 3: recursive record types
val make_d : v:e -> w:bool -> d
val make_e : x:int -> y:bool -> z:d -> e
end[@@ocaml.doc "@inline"][@@merlin.hide ]

Test 4: private type
$ test4="
> type f = private {
> x: int ;
> y: bool }[@@deriving make]"
$ echo "$test4" > test.mli
$ ./driver.exe test.mli
File "test.mli", line 2, characters 5-6:
2 | type f = private {
^
Error: We cannot expose functions that explicitly create private records.
[1]
2 changes: 1 addition & 1 deletion test/make/structure/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,5 @@ Test 6: recursive types without any record types
File "test.ml", lines 2-3, characters 0-32:
2 | type f = int*g
3 | and g = bool*f [@@deriving make]
Error: 'with fields' can only be applied on type definitions in which at least one type definition is a record
Error: make can only be applied on type definitions in which at least one type definition is a record.
[1]

0 comments on commit 8aa7321

Please sign in to comment.