tgensym_instantiationinfo.nim 608 B

12345678910111213141516171819202122232425
  1. discard """
  2. action: "compile"
  3. """
  4. # bug #7937
  5. template printError(error: typed) =
  6. # 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)
  7. let instInfo {.gensym.} = instantiationInfo()
  8. echo "Error at ", instInfo.filename, ':', instInfo.line, ": ", error
  9. # Removing this overload fixes the error
  10. template someTemplate(someBool: bool, body) =
  11. discard
  12. template someTemplate(body) =
  13. body
  14. proc main() =
  15. someTemplate:
  16. printError("ERROR 1")
  17. printError("ERROR 2")
  18. main()