diff options
author | Arne Döring <arne.doering@gmx.net> | 2020-03-22 20:03:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-22 20:03:51 +0100 |
commit | a5f02cac85281fc2804e910f330f0c11d3c4f77b (patch) | |
tree | 82aa1cfb13fc673a131d16fc9fb9c2a210741b0b /tests | |
parent | 64ffa17f0fac789f259d3db48a28f1605805a366 (diff) | |
download | Nim-a5f02cac85281fc2804e910f330f0c11d3c4f77b.tar.gz |
fix #13417 (#13712)
* fix #13417 * add test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/iter/titer_issues.nim | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/iter/titer_issues.nim b/tests/iter/titer_issues.nim index a7830dfab..b8a117e59 100644 --- a/tests/iter/titer_issues.nim +++ b/tests/iter/titer_issues.nim @@ -213,3 +213,24 @@ block t2023_objiter: var o = init() echo(o.iter()) + +block: + # bug #13417 + + var effectCounterP1 = 0 + + proc p1(): seq[int] = + inc effectCounterP1 + @[1,2] + + iterator ip1(v: openArray[int]): auto = + for x in v: + yield x + + var effectCounterLoop = 0 + + for x in ip1(p1()): + inc effectCounterLoop + + doAssert effectCounterP1 == 1 + doAssert effectCounterLoop == 2 |