diff options
-rw-r--r-- | compiler/sempass2.nim | 1 | ||||
-rw-r--r-- | tests/arc/tarcmisc.nim | 28 |
2 files changed, 29 insertions, 0 deletions
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index a2da2f2e4..6db6448df 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -799,6 +799,7 @@ proc trackCall(tracked: PEffects; n: PNode) = # check required for 'nim check': if n[1].typ.len > 0: + createTypeBoundOps(tracked, n[1].typ.lastSon, n.info) createTypeBoundOps(tracked, n[1].typ, n.info) # new(x, finalizer): Problem: how to move finalizer into 'createTypeBoundOps'? diff --git a/tests/arc/tarcmisc.nim b/tests/arc/tarcmisc.nim index a7f2dd98b..542e4f316 100644 --- a/tests/arc/tarcmisc.nim +++ b/tests/arc/tarcmisc.nim @@ -319,3 +319,31 @@ proc createMachine = echo machine.factory().hello createMachine() + +# bug #15122 + +import tables + +type + BENodeKind = enum + tkBytes, + tkList, + tkDict + + BENode = object + case kind: BENodeKind + of tkBytes: strVal: string + of tkList: listVal: seq[BENode] + of tkDict: dictVal: Table[string, BENode] + +var data = { + "examples": { + "values": BENode( + kind: tkList, + listVal: @[BENode(kind: tkBytes, strVal: "test")] + ) + }.toTable() +}.toTable() + +# For ARC listVal is empty for some reason +doAssert data["examples"]["values"].listVal[0].strVal == "test" |