diff options
author | Arne Döring <arne.doering@gmx.net> | 2020-04-07 14:42:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-07 14:42:59 +0200 |
commit | 37692baf49370d096e0d9ac2c8bf51ed7bd8cf8a (patch) | |
tree | 7ad23f49b978318539fad98f0f96e54cbe833568 /tests/iter | |
parent | 92c4aad2059a350e95bc7a64932873b41b085976 (diff) | |
download | Nim-37692baf49370d096e0d9ac2c8bf51ed7bd8cf8a.tar.gz |
fix #13739 (#13742)
Diffstat (limited to 'tests/iter')
-rw-r--r-- | tests/iter/titer_issues.nim | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/iter/titer_issues.nim b/tests/iter/titer_issues.nim index a7830dfab..872ebe2b7 100644 --- a/tests/iter/titer_issues.nim +++ b/tests/iter/titer_issues.nim @@ -18,6 +18,15 @@ end 1 2 7 +9002 +9004 +9006 +9008 +9010 +9012 +9014 +9016 +9018 ''' """ @@ -213,3 +222,21 @@ block t2023_objiter: var o = init() echo(o.iter()) + + +block: + # issue #13739 + iterator myIter(arg: openarray[int]): int = + var tmp = 0 + let len = arg.len + while tmp < len: + yield arg[tmp] * 2 + inc tmp + + proc someProc() = + var data = [4501,4502,4503,4504,4505,4506,4507,4508,4509] + # StmtListExpr should not get special treatment. + for x in myIter((discard;data)): + echo x + + someProc() |