tunpack_asgn.nim 433 B

1234567891011121314151617181920212223242526272829303132333435
  1. discard """
  2. output: '''2 4
  3. 4
  4. 2 0'''
  5. """
  6. proc foobar(): (int, int) = (2, 4)
  7. # test within a proc:
  8. proc pp(x: var int) =
  9. var y: int
  10. (y, x) = foobar()
  11. template pt(x) =
  12. var y: int
  13. (x, y) = foobar()
  14. # test within a generic:
  15. proc pg[T](x, y: var T) =
  16. pt(x)
  17. # test as a top level statement:
  18. var x, y, a, b: int
  19. # test for regression:
  20. (x, y) = (1, 2)
  21. (x, y) = fooBar()
  22. echo x, " ", y
  23. pp(a)
  24. echo a
  25. pg(a, b)
  26. echo a, " ", b