mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-24 08:15:25 +00:00
24
tests/template/tgensym_instantiationinfo.nim
Normal file
24
tests/template/tgensym_instantiationinfo.nim
Normal file
@@ -0,0 +1,24 @@
|
||||
discard """
|
||||
action: "compile"
|
||||
"""
|
||||
|
||||
# bug #7937
|
||||
|
||||
template printError(error: typed) =
|
||||
# Error: inconsistent typing for reintroduced symbol 'instInfo': previous type was: tuple[filename: string, line: int, column: int]; new type is: tuple of (string, int, int)
|
||||
let instInfo {.gensym.} = instantiationInfo()
|
||||
echo "Error at ", instInfo.filename, ':', instInfo.line, ": ", error
|
||||
|
||||
# Removing this overload fixes the error
|
||||
template someTemplate(someBool: bool, body) =
|
||||
discard
|
||||
|
||||
template someTemplate(body) =
|
||||
body
|
||||
|
||||
proc main() =
|
||||
someTemplate:
|
||||
printError("ERROR 1")
|
||||
printError("ERROR 2")
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user