tquadplus.nim 298 B

123456789101112131415161718
  1. # bug #1023
  2. discard """
  3. output: "1 == 1"
  4. """
  5. type Quadruple = tuple[a, b, c, d: int]
  6. proc `+`(s, t: Quadruple): Quadruple =
  7. (a: s.a + t.a, b: s.b + t.b, c: s.c + t.c, d: s.d + t.d)
  8. const
  9. A = (a: 0, b: -1, c: 0, d: 1)
  10. B = (a: 0, b: -2, c: 1, d: 0)
  11. C = A + B
  12. echo C.d, " == ", (A+B).d