t9177.nim 316 B

12345678910111213141516
  1. discard """
  2. action: run
  3. """
  4. block:
  5. var x = (a: 5, b: 1)
  6. x = (3 * x.a + 2 * x.b, x.a + x.b)
  7. doAssert x.a == 17
  8. doAssert x.b == 6
  9. block:
  10. # Transformation of a tuple constructor with named arguments
  11. var x = (a: 5, b: 1)
  12. x = (a: 3 * x.a + 2 * x.b, b: x.a + x.b)
  13. doAssert x.a == 17
  14. doAssert x.b == 6