diff options
Diffstat (limited to 'tests/template/tgensym_instantiationinfo.nim')
-rw-r--r-- | tests/template/tgensym_instantiationinfo.nim | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/template/tgensym_instantiationinfo.nim b/tests/template/tgensym_instantiationinfo.nim new file mode 100644 index 000000000..4b997ed6a --- /dev/null +++ b/tests/template/tgensym_instantiationinfo.nim @@ -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: (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() |