tsink.nim 398 B

12345678910111213141516171819202122232425
  1. discard """
  2. matrix: "--mm:arc"
  3. """
  4. type AnObject = object of RootObj
  5. value*: int
  6. proc mutate(shit: sink AnObject) =
  7. shit.value = 1
  8. proc foo = # bug #23359
  9. var bar = AnObject(value: 42)
  10. mutate(bar)
  11. doAssert bar.value == 42
  12. foo()
  13. block: # bug #23902
  14. proc foo(a: sink string): auto = (a, a)
  15. proc bar(a: sink int): auto = return a
  16. proc foo(a: sink string) =
  17. var x = (a, a)