-
Notifications
You must be signed in to change notification settings - Fork 23
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
Fix parsing numbers #299
Fix parsing numbers #299
Conversation
Use java.lang.Integer.decode which handles other radices besides 10 Also remove `_` from the number string
Try(Integer.parseInt(value.drop(2), 8)).toEither.left | ||
.map(t => ConstructError.from(t, "Int", node)) | ||
else if (value.startsWith("0x")) | ||
Try(Integer.parseInt(value.drop(2), 8)).toEither.left |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8 instead of 16.
But it's better to leave it to Long.decode
anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! I see that there is a failed test, could you take a look at it?
@tgodzik should be good now. Can you please run the CI workflow? 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks!
Use java.lang.Integer.decode which handles other radices besides 10
Also remove
_
from the number string