fixes #20089; remove setPointer since strings/seqs are not pointers anymore
This commit is contained in:
parent
3d5f10f0d0
commit
1c39af3389
2 changed files with 22 additions and 2 deletions
|
|
@ -163,6 +163,9 @@ proc loadAny(p: var JsonParser, a: Any, t: var Table[BiggestInt, pointer]) =
|
||||||
of akSequence:
|
of akSequence:
|
||||||
case p.kind
|
case p.kind
|
||||||
of jsonNull:
|
of jsonNull:
|
||||||
|
when defined(nimSeqsV2):
|
||||||
|
invokeNewSeq(a, 0)
|
||||||
|
else:
|
||||||
setPointer(a, nil)
|
setPointer(a, nil)
|
||||||
next(p)
|
next(p)
|
||||||
of jsonArrayStart:
|
of jsonArrayStart:
|
||||||
|
|
@ -230,6 +233,9 @@ proc loadAny(p: var JsonParser, a: Any, t: var Table[BiggestInt, pointer]) =
|
||||||
of akString:
|
of akString:
|
||||||
case p.kind
|
case p.kind
|
||||||
of jsonNull:
|
of jsonNull:
|
||||||
|
when defined(nimSeqsV2):
|
||||||
|
setString(a, "")
|
||||||
|
else:
|
||||||
setPointer(a, nil)
|
setPointer(a, nil)
|
||||||
next(p)
|
next(p)
|
||||||
of jsonString:
|
of jsonString:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
discard """
|
||||||
|
matrix: "--mm:orc; --mm:refc"
|
||||||
|
"""
|
||||||
|
|
||||||
import std/marshal
|
import std/marshal
|
||||||
|
|
||||||
# TODO: add static tests
|
# TODO: add static tests
|
||||||
|
|
@ -136,6 +140,16 @@ block:
|
||||||
let test = to[LegacyEntry](str)
|
let test = to[LegacyEntry](str)
|
||||||
doAssert $test == """(numeric: "")"""
|
doAssert $test == """(numeric: "")"""
|
||||||
|
|
||||||
|
block:
|
||||||
|
let str = """{"numeric": null}"""
|
||||||
|
|
||||||
|
type
|
||||||
|
LegacyEntry = object
|
||||||
|
numeric: seq[int]
|
||||||
|
|
||||||
|
var test = to[LegacyEntry](str)
|
||||||
|
doAssert $test == """(numeric: @[])"""
|
||||||
|
|
||||||
# bug #16022
|
# bug #16022
|
||||||
block:
|
block:
|
||||||
let p: proc (): string = proc (): string = "hello world"
|
let p: proc (): string = proc (): string = "hello world"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue