diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-09-11 01:50:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-11 01:50:42 +0200 |
commit | 0c41ac792b64b710b4702cd4ae88d4392744a1ea (patch) | |
tree | 5b4a4c5644f1f0feba69c038caf70b909cfb99c5 /tests | |
parent | 6a621b35e7c935655d3cafe840eb69d662e333b7 (diff) | |
download | Nim-0c41ac792b64b710b4702cd4ae88d4392744a1ea.tar.gz |
fixes #15122 (#15301)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/arc/theavy_recursion.nim | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/arc/theavy_recursion.nim b/tests/arc/theavy_recursion.nim new file mode 100644 index 000000000..9813331f4 --- /dev/null +++ b/tests/arc/theavy_recursion.nim @@ -0,0 +1,43 @@ +discard """ + output: "yay" + cmd: "nim c --gc:arc $file" +""" + +# bug #15122 + +import tables + +type + BENodeKind* = enum + tkEof, + tkBytes, + tkList, + tkDict + + BENode* = object + case kind: BENodeKind + of tkBytes: strVal: string + of tkList: listVal: seq[BENode] + of tkDict: dictVal*: Table[string, BENode] + else: + discard + +proc unused(s: string): BENode = + # bad: + result = BENode(kind: tkBytes, strVal: "abc") + +proc main = + 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" + +main() +echo "yay" |