Skip to content

Commit

Permalink
close nim-lang#2771(add testcase for nim-lang#2771) (nim-lang#15932)
Browse files Browse the repository at this point in the history
  • Loading branch information
ringabout authored and irdassis committed Feb 12, 2021
1 parent f2a6375 commit f6bad6f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/iter/t2771.nim
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f6bad6f

Please sign in to comment.