t13902.nim 342 B

12345678910111213
  1. #issue #13902
  2. block:
  3. type Slot = distinct uint64
  4. var s = Slot(1)
  5. proc `$`(x: Slot): string {.borrow.}
  6. proc `+=`(x: var Slot, y: uint64) {.borrow.}
  7. # test was failing with either 0 or 2 echos but not with 1 echo
  8. # echo "s = ", s
  9. s += 1
  10. # echo "s = ", s
  11. doAssert s.uint64 == 2, $s # was failing, showing 18419607611339964418