tvm.nim 493 B

12345678910111213141516171819202122
  1. block: # issue #17527
  2. iterator items2[IX, T](a: array[IX, T]): lent T {.inline.} =
  3. var i = low(IX)
  4. if i <= high(IX):
  5. while true:
  6. yield a[i]
  7. if i >= high(IX): break
  8. inc(i)
  9. proc main() =
  10. var s: seq[string] = @[]
  11. for i in 0..<3:
  12. for (key, val) in items2([("any", "bar")]):
  13. s.add $(i, key, val)
  14. doAssert s == @[
  15. "(0, \"any\", \"bar\")",
  16. "(1, \"any\", \"bar\")",
  17. "(2, \"any\", \"bar\")"
  18. ]
  19. static: main()