diff options
author | Antonis Geralis <43617260+planetis-m@users.noreply.github.com> | 2022-09-13 14:10:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-13 19:10:08 +0800 |
commit | 7c85b500df69cf5c5856549dafe59d7b619e8b26 (patch) | |
tree | 2e17f6361238d2fe69d6b877f86b0d3a529101ca | |
parent | c9a92117f9b78e3227dfe2cdcc7cf5b113185832 (diff) | |
download | Nim-7c85b500df69cf5c5856549dafe59d7b619e8b26.tar.gz |
Add testcase for bug #20305 (#20323)
* add testcase for bug #20305 * Update tcaseobj.nim Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
-rw-r--r-- | tests/arc/tcaseobj.nim | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/arc/tcaseobj.nim b/tests/arc/tcaseobj.nim index a967a509b..d52833e4d 100644 --- a/tests/arc/tcaseobj.nim +++ b/tests/arc/tcaseobj.nim @@ -10,6 +10,7 @@ begin end prevented (ok: true, value: "ok") +@[(kind: P, pChildren: @[])] myobj destroyed ''' """ @@ -244,3 +245,27 @@ block: doAssert j1.x1 == 2 doAssert j0.x0 == 2 + +# ------------------------------------ +# bug #20305 + +type + ContentNodeKind = enum + P, Br, Text + ContentNode = object + case kind: ContentNodeKind + of P: pChildren: seq[ContentNode] + of Br: discard + of Text: textStr: string + +proc bug20305 = + var x = ContentNode(kind: P, pChildren: @[ + ContentNode(kind: P, pChildren: @[ContentNode(kind: Text, textStr: "brrr")]) + ]) + x.pChildren.add ContentNode(kind: Br) + x.pChildren.del(0) + {.cast(uncheckedAssign).}: + x.pChildren[0].kind = P + echo x.pChildren + +bug20305() |