tvartypeclass.nim 191 B

123456789101112
  1. # issue #13302
  2. proc foo(x: object): int = x.i*2
  3. proc foo(x: var object) = x.i*=2
  4. type Foo = object
  5. i: int
  6. let x = Foo(i: 3)
  7. var y = Foo(i: 4)
  8. doAssert foo(x) == 6
  9. foo(y)
  10. doAssert y.i == 8