From 4e305c304014c5ef90413d6cab562f5e2b34e573 Mon Sep 17 00:00:00 2001 From: Ganesh Viswanathan Date: Fri, 14 Sep 2018 14:07:31 -0500 Subject: [PATCH] Test case for #7010 --- tests/distinct/t7010.nim | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/distinct/t7010.nim diff --git a/tests/distinct/t7010.nim b/tests/distinct/t7010.nim new file mode 100644 index 0000000000..0cae002be4 --- /dev/null +++ b/tests/distinct/t7010.nim @@ -0,0 +1,19 @@ +discard """ + exitcode: 0 + output: '''''' +""" + +# Snippet not defined as ```nim + +type MyInt* = distinct int + +proc `+`*(x: MyInt, y: MyInt): MyInt {.borrow.} +proc `+=`*(x: var MyInt, y: MyInt) {.borrow.} +proc `=`*(x: var MyInt, y: MyInt) {.borrow.} + +var next: MyInt + +proc getNext*() : MyInt = + result = next + next += 1.MyInt + next = next + 1.MyInt \ No newline at end of file