mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
fixes #20089; remove setPointer since strings/seqs are not pointers anymore
This commit is contained in:
@@ -163,7 +163,10 @@ proc loadAny(p: var JsonParser, a: Any, t: var Table[BiggestInt, pointer]) =
|
||||
of akSequence:
|
||||
case p.kind
|
||||
of jsonNull:
|
||||
setPointer(a, nil)
|
||||
when defined(nimSeqsV2):
|
||||
invokeNewSeq(a, 0)
|
||||
else:
|
||||
setPointer(a, nil)
|
||||
next(p)
|
||||
of jsonArrayStart:
|
||||
next(p)
|
||||
@@ -230,7 +233,10 @@ proc loadAny(p: var JsonParser, a: Any, t: var Table[BiggestInt, pointer]) =
|
||||
of akString:
|
||||
case p.kind
|
||||
of jsonNull:
|
||||
setPointer(a, nil)
|
||||
when defined(nimSeqsV2):
|
||||
setString(a, "")
|
||||
else:
|
||||
setPointer(a, nil)
|
||||
next(p)
|
||||
of jsonString:
|
||||
setString(a, p.str)
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
discard """
|
||||
matrix: "--mm:orc; --mm:refc"
|
||||
"""
|
||||
|
||||
import std/marshal
|
||||
|
||||
# TODO: add static tests
|
||||
@@ -136,6 +140,16 @@ block:
|
||||
let test = to[LegacyEntry](str)
|
||||
doAssert $test == """(numeric: "")"""
|
||||
|
||||
block:
|
||||
let str = """{"numeric": null}"""
|
||||
|
||||
type
|
||||
LegacyEntry = object
|
||||
numeric: seq[int]
|
||||
|
||||
var test = to[LegacyEntry](str)
|
||||
doAssert $test == """(numeric: @[])"""
|
||||
|
||||
# bug #16022
|
||||
block:
|
||||
let p: proc (): string = proc (): string = "hello world"
|
||||
|
||||
Reference in New Issue
Block a user