diff --git a/src/make/ppx_make.ml b/src/make/ppx_make.ml index 3e47358..95ac8db 100644 --- a/src/make/ppx_make.ml +++ b/src/make/ppx_make.ml @@ -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 ]) ;; diff --git a/test/make/signature/run.t b/test/make/signature/run.t index 73c1752..ac49e12 100644 --- a/test/make/signature/run.t +++ b/test/make/signature/run.t @@ -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] diff --git a/test/make/structure/run.t b/test/make/structure/run.t index b8a37fd..be3b7cb 100644 --- a/test/make/structure/run.t +++ b/test/make/structure/run.t @@ -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]