-
Notifications
You must be signed in to change notification settings - Fork 125
refactor: handle any json number #2370
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
Conversation
f433ac0
to
4c735e4
Compare
Inconsistent pattern matching for Number variant across codebaseCategory Redundant integer parsing and conversion in lex_number_endCategory Magic number constants should be extracted as named constantsCategory |
Pull Request Test Coverage Report for Build 252Details
💛 - Coveralls |
What should be the expected results of the following two expressions? @json.parse("1e2") == @json.parse("100")
@json.parse("1000000000000000000001") ==
@json.parse("1000000000000000000002") |
If we are lucky enough, the first should be equal, and the second would not be equal. Currently the parsing doesn't consider the One thing we can do is to decide whether it is floating. If it's not, only convert the number that is safe. But anyway, you are handling |
4c735e4
to
4f43620
Compare
6f03124
to
2724e15
Compare
let's get this landed in the next release, we can make some time for the AI to upgrade most packages |
9491cfb
to
78782d4
Compare
78782d4
to
5fab74b
Compare
(Array(a_arr), Array(b_arr)) => a_arr == b_arr | ||
(Object(a_obj), Object(b_obj)) => a_obj == b_obj | ||
_ => false | ||
} |
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.
match a {
Null => b is Null
...
}
Closes #1366
This implementation will introduce new field in
Json::Number
to hold the representation of the Json number that can't be put into aDouble
.The current implementation will decide during parsing, to use the
repr : String?
to hold the representations, if:Double
The corresponding value will be +/- inf, which aligns with the behavior of
Json.parse
in JS.The implementation of
Eq
will compare only the number part and ignore the representation part.