summary refs log tree commit diff stats
path: root/tests/distinct/t7010.nim
blob: 0cae002be458f113e40f2388fec72fa8397ca6cd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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