texplicit_sink.nim 405 B

123456789101112131415161718192021222324252627282930
  1. discard """
  2. output: '''de'''
  3. cmd: '''nim c --mm:arc --expandArc:main $file'''
  4. nimout: '''--expandArc: main
  5. var
  6. a
  7. b_cursor
  8. try:
  9. a = f "abc"
  10. b_cursor = "de"
  11. `=sink`(a, b_cursor)
  12. echo [a]
  13. finally:
  14. `=destroy`(a)
  15. -- end of expandArc ------------------------'''
  16. """
  17. # bug #20572
  18. proc f(s: string): string = s
  19. proc main =
  20. var a = f "abc"
  21. var b = "de"
  22. `=sink`(a, b)
  23. echo a
  24. main()