Bug 19297 – JSONValue of signed and unsigned equal values is not equal

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-10-10T13:12:15Z
Last change time
2018-10-27T00:38:28Z
Assigned to
No Owner
Creator
FeepingCreature

Comments

Comment #0 by default_357-line — 2018-10-10T13:12:15Z
Repro: assert(JSONValue([].length) == JSONValue(0)); JSONValue treats them as two different types because one is signed and one is unsigned. Which is of course nonsense and against spec. JSON doesn't even have unsigned types; strictly speaking you're supposed to just use doubles for ints, like JS does. But if there have to be integers in JSONValue, they should work with doubles, and they *certainly* should work with *themselves*.
Comment #1 by github-bugzilla — 2018-10-27T00:38:28Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/b07b2154242a3278f6ee68b2aebfe83019f9fc6b Fix issue 19297: handle comparison of signed, unsigned and floating JSONValues https://github.com/dlang/phobos/commit/76ef073df35bb22ee0ad3fb10e66ce024c642175 Merge pull request #6726 from FeepingCreature/fix/Issue-19297-handle-jsonvalue-signed-unsigned-comparison Fix issue 19297: handle comparison of signed, unsigned and floating JSONValues as in D merged-on-behalf-of: Vladimir Panteleev <[email protected]>