Closed glennsl closed 2 years ago
This makes the ppx not reject locally abstract type definitions (e.g. (type a)) and type constraints on component definitions.
(type a)
For example, these used to be rejected:
let%component make (type a) ~(foo : a) : _ = div [||] [] let%component make : type a. foo:a -> _ = fun ~foo:_ -> div [||] []
with the error
react.component calls can only be on function definitions or component wrappers (forward_ref, memo).
The latter also produced the error:
Fatal error: exception (Invalid_argument "react.component calls cannot be destructured.")
Which has been improved, along with a few other errors, by using Location.raise_errorf instead of invalid_arg.
Location.raise_errorf
invalid_arg
Really great! I just bumped into this yesterday :D
This makes the ppx not reject locally abstract type definitions (e.g.
(type a)
) and type constraints on component definitions.For example, these used to be rejected:
with the error
The latter also produced the error:
Which has been improved, along with a few other errors, by using
Location.raise_errorf
instead ofinvalid_arg
.