parent
a6d4421241
commit
2fba65b29f
2 changed files with 28 additions and 3 deletions
|
|
@ -93,9 +93,10 @@ proc semInstantiationInfo(c: PContext, n: PNode): PNode =
|
||||||
line.intVal = toLinenumber(info)
|
line.intVal = toLinenumber(info)
|
||||||
var column = newNodeIT(nkIntLit, n.info, getSysType(c.graph, n.info, tyInt))
|
var column = newNodeIT(nkIntLit, n.info, getSysType(c.graph, n.info, tyInt))
|
||||||
column.intVal = toColumn(info)
|
column.intVal = toColumn(info)
|
||||||
result.add(filename)
|
# filename: string, line: int, column: int
|
||||||
result.add(line)
|
result.add(newTree(nkExprColonExpr, n.typ.n[0], filename))
|
||||||
result.add(column)
|
result.add(newTree(nkExprColonExpr, n.typ.n[1], line))
|
||||||
|
result.add(newTree(nkExprColonExpr, n.typ.n[2], column))
|
||||||
|
|
||||||
proc toNode(t: PType, i: TLineInfo): PNode =
|
proc toNode(t: PType, i: TLineInfo): PNode =
|
||||||
result = newNodeIT(nkType, i, t)
|
result = newNodeIT(nkType, i, t)
|
||||||
|
|
|
||||||
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()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue