summary refs log tree commit diff stats
path: root/tests/specialops/tsetter.nim
blob: 6175cbec4c4a116bc4fd42a746b844aae7efc1fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
block: # ensure RHS of setter statement is treated as call operand
  proc `b=`(a: var int, c: proc (x: int): int) =
    a = c(a)

  proc foo(x: int): int = x + 1
  proc foo(x: float): float = x - 1

  var a = 123
  a.b = foo
  doAssert a == 124