Skip to content

Commit

Permalink
closes #12994; add testcase (#20511)
Browse files Browse the repository at this point in the history
  • Loading branch information
ringabout authored Oct 7, 2022
1 parent c651817 commit a132f55
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/vm/tvmmisc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit a132f55

Please sign in to comment.