Files
Nim/tests/template/tcallsitelineinfo.nim
metagn 2cca38d33c pragma for sfCallsite instead of name check + better semantics, test (#20464)
* pragma for sfCallsite instead of name check at every template definition

Not documented because it seems to be for internal use?

Should also make it possible to make comparisons and setops imports, but this doesn't have to be done.

I can reuse a name like `cursor` for the pragma as well, added a new name just to be safe.

* make sfCallsite recursive, add tests
2022-10-03 06:07:55 +02:00

18 lines
330 B
Nim

discard """
nimout: '''
tcallsitelineinfo.nim(17, 4) Warning: abc [User]
'''
exitcode: 1
outputsub: '''
tcallsitelineinfo.nim(17) tcallsitelineinfo
Error: unhandled exception: def [ValueError]
'''
"""
template foo(): untyped {.callsite.} =
{.warning: "abc".}
raise newException(ValueError, "def")
echo "hello"
foo()