t17812.nim 545 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. discard """
  2. targets: "c js"
  3. matrix: "--gc:refc; --gc:arc"
  4. """
  5. import std/times
  6. block: # bug #17812
  7. block:
  8. type
  9. Task = object
  10. cb: proc ()
  11. proc hello() = discard
  12. let t = Task(cb: hello)
  13. doAssert t.repr.len > 0
  14. block:
  15. type MyObj = object
  16. field: DateTime
  17. proc `$`(o: MyObj): string = o.repr
  18. doAssert ($MyObj()).len > 0
  19. # bug #22175
  20. type Xxx = object
  21. value: string
  22. proc complete(xxx: ref Xxx, v: sink string) =
  23. xxx.value = move(v)
  24. let yyy = (ref Xxx)()
  25. yyy.complete("test")