diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2022-10-08 00:27:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-08 00:27:17 +0800 |
commit | a132f5502acbd53781802579d89d6ca5168e74cd (patch) | |
tree | c7a05cafa58f8a9a0053acfe4fab9586abf3bf38 /tests/vm | |
parent | c651817ffd065e9569e04aeee0f679fc15eb9dbf (diff) | |
download | Nim-a132f5502acbd53781802579d89d6ca5168e74cd.tar.gz |
closes #12994; add testcase (#20511)
Diffstat (limited to 'tests/vm')
-rw-r--r-- | tests/vm/tvmmisc.nim | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/vm/tvmmisc.nim b/tests/vm/tvmmisc.nim index dfe086d10..25ec2cc12 100644 --- a/tests/vm/tvmmisc.nim +++ b/tests/vm/tvmmisc.nim @@ -572,3 +572,26 @@ block: let y = x + 1 # Error: unhandled exception: value out of range: -8 notin 0 .. 65535 [RangeDefect] echo y + + +type Atom* = object + bar: int + +proc main() = # bug #12994 + var s: seq[Atom] + var atom: Atom + var checked = 0 + for i in 0..<2: + atom.bar = 5 + s.add atom + atom.reset + if i == 0: + checked += 1 + doAssert $s == "@[(bar: 5)]" + else: + checked += 1 + doAssert $s == "@[(bar: 5), (bar: 5)]" + doAssert checked == 2 + +static: main() +main() |