tquadplus.nim 283 B

123456789101112131415
  1. # bug #1023
  2. type Quadruple = tuple[a, b, c, d: int]
  3. proc `+`(s, t: Quadruple): Quadruple =
  4. (a: s.a + t.a, b: s.b + t.b, c: s.c + t.c, d: s.d + t.d)
  5. const
  6. A = (a: 0, b: -1, c: 0, d: 1)
  7. B = (a: 0, b: -2, c: 1, d: 0)
  8. C = A + B
  9. doAssert $C.d & " == " & $(A+B).d == "1 == 1"