tproper_stacktrace2.nim 413 B

123456789101112131415161718192021222324
  1. discard """
  2. matrix: "--stackTrace:on"
  3. outputsub: '''tproper_stacktrace2.nim(21) main'''
  4. exitcode: 1
  5. """
  6. proc returnsNil(): ref int = return nil
  7. iterator fields*(a, b: int): int =
  8. if a == b:
  9. for f in a..b:
  10. yield f
  11. else:
  12. for f in a..b:
  13. yield f
  14. proc main(): string =
  15. result = ""
  16. for i in fields(0, 1):
  17. let x = returnsNil()
  18. result &= "string literal " & $x[]
  19. echo main()