fix #17383: json.%,to and jsonutils.formJson,toJson now works with uint|uint64 (#17389) [backport:1.2]

* fix #17383: json.%,to and jsonutils.formJson,toJson now works with uint|uint64
* fixup
* fix for js
This commit is contained in:
Timothee Cour 2021-03-16 13:44:54 -07:00 • committed by GitHub
commit 895a40d1ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 6 deletions

View file

@ -67,6 +67,21 @@ template fn() =
doAssert b2.ord == 1 # explains the `1`
testRoundtrip(a): """[1,2,3]"""
block: # bug #17383
block:
let a = (int32.high, uint32.high)
testRoundtrip(a): "[2147483647,4294967295]"
when not defined(js):
block:
let a = (int64.high, uint64.high)
testRoundtrip(a): "[9223372036854775807,18446744073709551615]"
block:
let a = (int.high, uint.high)
when int.sizeof == 4:
testRoundtrip(a): "[2147483647,4294967295]"
else:
testRoundtrip(a): "[9223372036854775807,18446744073709551615]"
block: # case object
type Foo = object
x0: float