Crystal: wrong stack trace number when using $X

Created on 12 Oct 2018  路  5Comments  路  Source: crystal-lang/crystal

0.26.1

somewhat minimal example:

$ cat file.cr
"" =~ /(abc)/
{a: $1, b: $2}
$ /usr/bin/crystal file.cr 
Unhandled exception: Nil assertion failed (Exception)
  from /usr/share/crystal/src/class.cr:148:0 in 'not_nil!'
  from file.cr:0:5 in '__crystal_main'
  from /usr/share/crystal/src/crystal/main.cr:97:5 in 'main_user_code'
  from /usr/share/crystal/src/crystal/main.cr:86:7 in 'main'
  from /usr/share/crystal/src/crystal/main.cr:106:3 in 'main'
  from __libc_start_main
  from ???

notice the "file.cr:0:5", not quite sure what line 0 means...wasn't sure if this is a dupe of other issues or not.

All 5 comments

Related to #5567.

The message Nil assertion failed is also not very detailed for this kind of error. Uers might have a hard time to understand what it means in this context.

this particular example seems fixed with 0.31.1. Feel free to close or leave open if you want to address the cryptic message at some point :)

Fixed in #8234

The error message should better be a separate issue.

There is already #4776 to track the error message/error behaviour.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nabeelomer picture nabeelomer  路  3Comments

asterite picture asterite  路  3Comments

asterite picture asterite  路  3Comments

grosser picture grosser  路  3Comments

will picture will  路  3Comments