summary refs log blame commit diff stats
path: root/tests/vm/tquadplus.nim
blob: 552e8fef72f4ac414093fe5884aa03cff1d9f2d6 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                          
# bug #1023

discard """
  output: "1 == 1"
"""

type Quadruple = tuple[a, b, c, d: int]

proc `+`(s, t: Quadruple): Quadruple =
  (a: s.a + t.a, b: s.b + t.b, c: s.c + t.c, d: s.d + t.d)

const
  A = (a: 0, b: -1, c: 0, d: 1)
  B = (a: 0, b: -2, c: 1, d: 0)
  C = A + B

echo C.d, " == ", (A+B).d