-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
InstanciationInfo() gives the wrong line number inside nested template calls.
I remember seeing this behavior inside the stdlib especially when triggering assert on changing sequence size while iterating.
The issue appears to be even worse inside deeply nested templates.
Here is a test file to reproduce the issue.
type
LineInfo = tuple[filename: string, line: int]
proc proc_impl(msgid: string; info: LineInfo) =
echo(info.filename, "(", info.line, ") message: ", msgid)
template templ3*(msgid: string): expr =
proc_impl(msgid, instantiationInfo())
template templ2*(msgid: string): expr =
templ3(msgid)
template templ1*(msgid: string): expr =
templ2(msgid)
proc main() =
templ1("hello world!")
main()