titerovl.nim 308 B

12345678910111213141516171819202122
  1. discard """
  2. output: '''9
  3. 1
  4. 2
  5. 3
  6. '''
  7. """
  8. # Test the new overloading rules for iterators:
  9. # test that iterator 'p' is preferred:
  10. proc p(): seq[int] = @[1, 2, 3]
  11. iterator p(): int = yield 9
  12. for x in p(): echo x
  13. # test that 'q' works in this position:
  14. proc q(): seq[int] = @[1, 2, 3]
  15. for x in q(): echo x