Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inim -s=mybug.nim crashes (should not crash, as done with inim ; import mybug) #29

Closed
timotheecour opened this issue Jul 18, 2018 · 2 comments

Comments

@timotheecour
Copy link
Contributor

timotheecour commented Jul 18, 2018

bugs/t59_array_index.nim:

let a = @["a", "b", "c"]
echo a
echo a[^0]
  • inim -s=bugs/t59_array_index.nim should not crash
    BAD:
inim -s=bugs/t59_array_index.nim
inim_1531876765
/Users/timothee/git_clone/nim/Nim/lib/system.nim(3597) []
/Users/timothee/git_clone/nim/Nim/lib/system.nim(2807) sysFatal
Error: unhandled exception: index out of bounds [IndexError]
Error: execution of an external program failed: '/private/tmp/inim_1531876765 '

GOOD: doesn't crash, handles error gracefully when calling a crashing cmd

inim
INim 0.2.5
Nim Compiler Version 0.18.1 [MacOSX: amd64] at /Users/timothee/.nimble/bin/nim
>>> import bugs/t59_array_index
t59_array_index
/Users/timothee/git_clone/nim/Nim/lib/system.nim(3597) []
/Users/timothee/git_clone/nim/Nim/lib/system.nim(2807) sysFatal
Error: unhandled exception: index out of bounds [IndexError]
Error: execution of an external program failed: '/private/tmp/inim_1531876771 '
>>>

@AndreiRegiani
Copy link
Member

Fixed in v0.3.1

# ...
inim> echo a[^0]
Error: unhandled exception: index out of bounds [IndexError]
inim> 123
123 : int literal(123)

Doesn't crash / doesn't mess with the compilable code buffer afterwards. Btw you don't need to echo these, the discard is feature is working on most cases.

@timotheecour
Copy link
Contributor Author

timotheecour commented Jul 26, 2018

Btw you don't need to echo these, the discard is feature is working on most cases.

I do because I'm using import bugs/t59_array_index or inim -s=bugs/t59_array_index.nim in this case ; in any case I moved the discussion to #34 (sorry for lack of clarity in the issue that was here)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants