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

Formatter error with one-line begin/rescue #6256

Closed
t-richards opened this issue Jun 25, 2018 · 0 comments
Closed

Formatter error with one-line begin/rescue #6256

t-richards opened this issue Jun 25, 2018 · 0 comments

Comments

@t-richards
Copy link

Problem summary

crystal tool format crashes with "Error: couldn't format". I suspect this is because begin/rescue are on the same line.

Core information

OS: Arch Linux

$ crystal --version
Crystal 0.25.0 (2018-06-12)

LLVM: 6.0.0
Default target: x86_64-pc-linux-gnu

Complete error output

$ crystal tool format example.cr 
Error: couldn't format 'example.cr', please report a bug including the contents of it: https://github.com/crystal-lang/crystal/issues

expecting DELIMITER_START, not `[, `, at :4:22 (Exception)
Error opening file 'crystal' with mode 'r': No such file or directory
Unhandled exception: Error opening file 'crystal' with mode 'r': No such file or directory (Errno)
Failed to raise an exception: END_OF_STACK
[0x55fb443185b6] ???
[0x55fb43a66fab] __crystal_raise +43
[0x55fb43a6852c] ???
[0x55fb43a78b92] ???
[0x55fb43a7205b] ???
[0x55fb43a713aa] ???
[0x55fb43a6dea9] ???
[0x55fb43aa0161] ???
[0x55fb43a6aa3d] main +205
[0x7fa48db1906b] __libc_start_main +235
[0x55fb43a6373a] _start +42
[0x0] ???

Contents of example.cr

As requested by the error above. This code may not do things "the right way"™, but technically it does compile and run.

# File: example.cr

data = {} of String => Int32
my_value = begin data["a"] rescue 0 end
puts my_value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants