You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
11 | type input_element = string input string_element [@@deriving json]
^^^^^^^^^^^^
Error: This expression has type string input -> Js__Js_json.t
but an expression was expected of type string -> 'a
Type string input is not compatible with type string
After some fiddling, I found out the error went away if I renamed the type variable to something other than 'string, e.g.:
My hypothesis about why the error happens is that the generated arguments take the name from the type argument. As I had 'string, the ppx generates args like string_to_json and string_of_json, and at some point the type checker infers the wrong types.
As the ppx can generate invalid names, maybe it could generate names with invalid chars so there's no this kind of confusion?
Side note: unfortunately, I've not been able to reproduce in an isolated test.
The text was updated successfully, but these errors were encountered:
I was working with a code like this:
and started getting an error like:
After some fiddling, I found out the error went away if I renamed the type variable to something other than
'string
, e.g.:My hypothesis about why the error happens is that the generated arguments take the name from the type argument. As I had
'string
, the ppx generates args likestring_to_json
andstring_of_json
, and at some point the type checker infers the wrong types.As the ppx can generate invalid names, maybe it could generate names with invalid chars so there's no this kind of confusion?
Side note: unfortunately, I've not been able to reproduce in an isolated test.
The text was updated successfully, but these errors were encountered: