summary refs log tree commit diff stats
path: root/tests/tuples/tunpack_asgn.nim
blob: 1dc7ff07499e4d0fd83b1232c5363430cf5575fd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
discard """
  output: '''2 4
4
2 0'''
"""

proc foobar(): (int, int) = (2, 4)

# test within a proc:
proc pp(x: var int) =
  var y: int
  (y, x) = foobar()

template pt(x) =
  var y: int
  (x, y) = foobar()

# test within a generic:
proc pg[T](x, y: var T) =
  pt(x)

# test as a top level statement:
var x, y, a, b: int
# test for regression:
(x, y) = (1, 2)
(x, y) = fooBar()

echo x, " ", y

pp(a)
echo a

pg(a, b)
echo a, " ", b