Repr v2 progress (#13268)

* progress on repr_v2

* repr progress

* add ref objects with distrinct

* fix failing tests
This commit is contained in:
cooldome 2020-01-28 19:05:57 +00:00 • committed by Andreas Rumpf
commit 76ede7c198
4 changed files with 97 additions and 78 deletions

34
tests/arc/trepr.nim Normal file
View file

@ -0,0 +1,34 @@
discard """
cmd: "nim c --gc:arc $file"
nimout: '''(a: true, n: doAssert)
Table[system.string, trepr.MyType](data: @[], counter: 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)