parent
8a21f94c72
commit
7d51ad96e9
1 changed files with 21 additions and 0 deletions
21
tests/iter/t2771.nim
Normal file
21
tests/iter/t2771.nim
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
template t1(i: int): int=
|
||||
i+1
|
||||
template t2(i: int): int=
|
||||
i+1
|
||||
|
||||
doAssert t1(10).t2() == 12
|
||||
|
||||
|
||||
template it1(i: int): iterator(): int =
|
||||
iterator result(): int {.closure, gensym.} =
|
||||
yield i+1
|
||||
result
|
||||
|
||||
template it2(iter: iterator(): int): iterator(): int =
|
||||
iterator result(): int {.closure, gensym.} =
|
||||
yield iter()+1
|
||||
result
|
||||
|
||||
let x2 = it1(10).it2()
|
||||
|
||||
doAssert x2() == 12
|
||||
Loading…
Add table
Add a link
Reference in a new issue