Fix #9111; error when parsing to aliased type field
This commit is contained in:
parent
c404163bbf
commit
5624036251
1 changed files with 15 additions and 1 deletions
|
|
@ -1147,7 +1147,7 @@ proc processType(typeName: NimNode, obj: NimNode,
|
||||||
`getEnumCall`
|
`getEnumCall`
|
||||||
)
|
)
|
||||||
of nnkSym:
|
of nnkSym:
|
||||||
let name = ($typeName).normalize
|
let name = normalize($typeName.getTypeImpl())
|
||||||
case name
|
case name
|
||||||
of "string":
|
of "string":
|
||||||
result = quote do:
|
result = quote do:
|
||||||
|
|
@ -1639,3 +1639,17 @@ when isMainModule:
|
||||||
# bug #6438
|
# bug #6438
|
||||||
doAssert($ %*[] == "[]")
|
doAssert($ %*[] == "[]")
|
||||||
doAssert($ %*{} == "{}")
|
doAssert($ %*{} == "{}")
|
||||||
|
|
||||||
|
# bug #9111
|
||||||
|
block:
|
||||||
|
type
|
||||||
|
Bar = string
|
||||||
|
Foo = object
|
||||||
|
a: int
|
||||||
|
b: Bar
|
||||||
|
|
||||||
|
let
|
||||||
|
js = """{"a": 123, "b": "abc"}""".parseJson
|
||||||
|
foo = js.to Foo
|
||||||
|
|
||||||
|
doAssert(foo.b == "abc")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue