fix: std/marshal unmarshaling of ref objects (#22983)

Fixes #16496 

![Marshal doesn't properly unmarshal *most* ref objects; the exceptions
being nil
ones](https://github-production-user-asset-6210df.s3.amazonaws.com/4764481/285471431-a39ee2c5-5670-4b12-aa10-7a10ba6b5b96.gif)
Test case added.

Note that this test (t9754) does pass locally, but there are tons of
failures by default on OS X arm64, mostly around the bohem GC, so it's
pretty spammy, and could easily have missed something. If there are
better instructions please do let me know.

---------

Co-authored-by: John Viega <viega@Johns-MacBook-Pro.local>
Co-authored-by: John Viega <viega@Johns-MBP.localdomain>
Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
This commit is contained in:
John Viega
2023-11-26 00:32:32 -05:00
committed by GitHub
parent 26f2ea149c
commit 5b2fcabff5
2 changed files with 43 additions and 2 deletions

View File

@@ -210,7 +210,8 @@ proc loadAny(p: var JsonParser, a: Any, t: var Table[BiggestInt, pointer]) =
setPointer(a, nil)
next(p)
of jsonInt:
setPointer(a, t.getOrDefault(p.getInt))
var raw = t.getOrDefault(p.getInt)
setPointer(a, addr raw)
next(p)
of jsonArrayStart:
next(p)