summary refs log tree commit diff stats
path: root/tests/arc/trepr.nim
blob: 391622ff6d04f1eeae38db4f51c21a7af47dba44 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
discard """
  cmd: "nim c --gc:arc $file"
  nimout: '''(a: true, n: doAssert)
Table[system.string, trepr.MyType](data: @[], counter: 0, countDeleted: 0)
nil
'''
"""
import tables

type
  NimSym = distinct NimNode
  MyType = tuple
    a: bool
    n: NimSym

proc myproc(t: MyType) =
  echo repr(t)

proc myproc2(t: MyType) =
  var x = Table[string, t]()
  echo repr(x)

proc myproc3(t: MyType) =
  var x: TableRef[string, t]
  echo repr(x)


macro dumpSym(a: typed) =
  myproc((a: true, n: NimSym(a)))
  myproc2((a: true, n: NimSym(a)))
  myproc3((a: true, n: NimSym(a)))

dumpSym(doAssert)