doAssert, assert now print full path of failing line on error (#8555)

This commit is contained in:
Timothee Cour 2018-08-25 12:48:37 -07:00 • committed by Andreas Rumpf
commit 3a626179ee
6 changed files with 109 additions and 32 deletions

11
lib/system/helpers.nim Normal file
View file

@ -0,0 +1,11 @@
## helpers used system.nim and other modules, avoids code duplication while
## also minimizing symbols exposed in system.nim
#
# TODO: move other things here that should not be exposed in system.nim
proc lineInfoToString(file: string, line, column: int): string =
file & "(" & $line & ", " & $column & ")"
proc `$`(info: type(instantiationInfo(0))): string =
# The +1 is needed here
lineInfoToString(info.fileName, info.line, info.column+1)