tcallsitelineinfo2.nim 488 B

123456789101112131415161718192021
  1. discard """
  2. nimout: '''
  3. tcallsitelineinfo2.nim(18, 1) Warning: abc [User]
  4. tcallsitelineinfo2.nim(19, 12) Warning: def [User]
  5. '''
  6. exitcode: 1
  7. outputsub: '''
  8. tcallsitelineinfo2.nim(20) tcallsitelineinfo2
  9. Error: unhandled exception: ghi [ValueError]
  10. '''
  11. """
  12. template foo(a: untyped): untyped {.callsite.} =
  13. {.warning: "abc".}
  14. a
  15. echo "hello"
  16. foo: # with `{.line.}:`, the following do not keep their line information:
  17. {.warning: "def".}
  18. raise newException(ValueError, "ghi")