summary refs log tree commit diff stats
path: root/tests/template/tcallsitelineinfo2.nim
blob: d5f2574749569e5d24278d7e525a3c1cb3d5ee53 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
discard """
  nimout: '''
tcallsitelineinfo2.nim(18, 1) Warning: abc [User]
tcallsitelineinfo2.nim(19, 12) Warning: def [User]
'''
  exitcode: 1
  outputsub: '''
tcallsitelineinfo2.nim(20) tcallsitelineinfo2
Error: unhandled exception: ghi [ValueError]
'''
"""

template foo(a: untyped): untyped {.callsite.} =
  {.warning: "abc".}
  a
  echo "hello"

foo: # with `{.line.}:`, the following do not keep their line information:
  {.warning: "def".}
  raise newException(ValueError, "ghi")