summary refs log tree commit diff stats
path: root/tests/ccgbugs/t13902.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ccgbugs/t13902.nim')
-rw-r--r--tests/ccgbugs/t13902.nim12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ccgbugs/t13902.nim b/tests/ccgbugs/t13902.nim
new file mode 100644
index 000000000..fd4f76d15
--- /dev/null
+++ b/tests/ccgbugs/t13902.nim
@@ -0,0 +1,12 @@
+
+#issue #13902
+block:
+  type Slot = distinct uint64
+  var s = Slot(1)
+  proc `$`(x: Slot): string {.borrow.}
+  proc `+=`(x: var Slot, y: uint64) {.borrow.}
+  # test was failing with either 0 or 2 echos but not with 1 echo
+  # echo "s = ", s
+  s += 1
+  # echo "s = ", s
+  doAssert s.uint64 == 2, $s # was failing, showing 18419607611339964418