In this traceback, the line number of the main module causing the fault is not displayed:
ms:nim jim$ nim c -r x4
Hint: used config file '/Users/jim/nim-1.2.1/config/nim.cfg' [Conf]
Hint: system [Processing]
Hint: widestrs [Processing]
Hint: io [Processing]
Hint: x4 [Processing]
CC: stdlib_io.nim
CC: stdlib_system.nim
CC: x4.nim
Hint: [Link]
Hint: 14207 LOC; 0.630 sec; 18.965MiB peakmem; Debug build; proj: /Users/jim/nim/x4; out: /Users/jim/nim/x4 [SuccessX]
Hint: /Users/jim/nim/x4 [Exec]
/Users/jim/nim/x4.nim x4
/Users/jim/nim-1.2.1/lib/system/fatal.nim(49) sysFatal
Error: unhandled exception: index out of bounds, the container is empty [IndexError]
Error: execution of an external program failed: '/Users/jim/nim/x4 '
ms:nim jim$ nim -v
Nim Compiler Version 1.2.1 [MacOSX: amd64]
Compiled at 2020-05-19
Copyright (c) 2006-2020 by Andreas Rumpf
git hash: 9b510643faeb7eb072af83fa14e7d1a86116c65f
active boot switches: -d:release
I guess posting the code would be a good idea:
var i: string
i[10] = 'j'
echo i
Workaround - if you do
var i = ""
instead, it shows the line number :)@yardanico that's a wrong, unrelated line number as you can see here:
when defined case2:
echo "ok0"
var i = ""
var u0 = 12
echo "ok1" ## <- line number points to here
const u1 = 12
var u2 = 12
i[10] = 'j'
echo i
let's follow up instead in line number missing from stacktrace · Issue #14444 · nim-lang/Nim