summary refs log blame commit diff stats
path: root/tests/template/tgensym_instantiationinfo.nim
blob: 305e7e1c3a3a76b15ec2e3c2aca961640475c325 (plain) (tree)























                                                                                                                                                                               
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()