summary refs log tree commit diff stats
path: root/tests/template/tgensym_instantiationinfo.nim
blob: 4b997ed6a056610f04e659d2ef2e15b057065b90 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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()