-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve ppx_repr
error message when shadowing a Stdlib
type without @nobuiltin
#63
Comments
At some level, this is expected and is what the In this case, we could do better because |
Thanks for the precisions. The biggest problem here is that the error message is very misleading, it took me a while to understand this was caused by a name clash. Ideally, an error message would have suggested me to use When Repr sees a |
Yep, good point. This is part of a larger problem with PPXes having no way to hook into the error message mechanism. It's possible we could emit code like the following: (* In a PPX runtime library *)
type ('a, 'b) expected_equality = Refl : ('a, 'a) expected_equality
(* In user code *)
type (_, _) result = unit
type foo = int * (bool, string) result
let foo_t =
let _ : (('a, 'b) result, ('a, 'b) Stdlib.result) expected_equality = Ppx_repr_runtime.Refl in
... which would produce an error of the following sort:
It's very possible that there are ways to coerce a better error message out of OCaml. |
ppx_repr
doesn't work with types shadowing stdlib typesppx_repr
error message when shadowing a Stdlib
type without @nobuiltin
causes
The text was updated successfully, but these errors were encountered: