File: tjsonmacro_reject2.nim

package info (click to toggle)
nim 0.19.4-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 462,356 kB
  • sloc: sh: 11,089; ansic: 4,699; makefile: 706; python: 309; sql: 297; asm: 141; xml: 13
file content (21 lines) | stat: -rw-r--r-- 361 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
discard """
  file: "tjsonmacro_reject2.nim"
  line: 10
  errormsg: "The `to` macro does not support ref objects with cycles."
"""
import json

type
  Misdirection = object
    cycle: Cycle

  Cycle = ref object
    foo: string
    cycle: Misdirection

let data = """
  {"cycle": null}
"""

let dataParsed = parseJson(data)
let dataDeser = to(dataParsed, Cycle)