Skip to content
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

Handle int64 and IntLit #11

Closed
NathanReb opened this issue Dec 4, 2018 · 0 comments
Closed

Handle int64 and IntLit #11

NathanReb opened this issue Dec 4, 2018 · 0 comments

Comments

@NathanReb
Copy link
Owner

let json = [%yojson 1]

is rewritten as

let json = `Int 1

which is fine but in some case we would like to be able to have it rewritten to:

let json = `Intlit "1"

because when using ppx_deriving_yojson for instance, some small int values will still be converted to Intlit, as would [%to_yojson: int64] 1L.

A good first step is probably to accept such litterals and the payload and rewrite them as Intlit, ie:

let json = [%yojson 1L]

gets rewritten as the above example.

NathanReb pushed a commit that referenced this issue Dec 4, 2018
Fixes #11

They are handled in the same way `ppx_deriving_yojson` handles such
values ie always interpreted as `Intlit`. This is particularly useful
when writing test code for parsers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant