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

Rufo crashes on nested empty hash literal #152

Closed
lparry opened this issue Feb 11, 2019 · 0 comments
Closed

Rufo crashes on nested empty hash literal #152

lparry opened this issue Feb 11, 2019 · 0 comments

Comments

@lparry
Copy link
Contributor

lparry commented Feb 11, 2019

I've got a test case here: lparry@9c4e59c

the following causes rufo to explode:

{ 1 => {} }

output:

Failures:

  1) Rufo::Formatter formatter_source_specs/hash_literal.rb.spec formats unnamed test (line: 138)
     Failure/Error: case node.first

     NoMethodError:
       undefined method `first' for nil:NilClass
     # ./lib/rufo/formatter.rb:3840:in `node_line'
     # ./lib/rufo/formatter.rb:3842:in `node_line'
     # ./lib/rufo/formatter.rb:3851:in `node_line'
     # ./lib/rufo/formatter.rb:3855:in `node_line'
     # ./lib/rufo/formatter.rb:3842:in `node_line'
     # ./lib/rufo/formatter.rb:3832:in `need_space_for_hash?'
     # ./lib/rufo/formatter.rb:2305:in `visit_hash'
     # ./lib/rufo/formatter.rb:420:in `visit'
     # ./lib/rufo/formatter.rb:522:in `block (2 levels) in visit_exps'
     # ./lib/rufo/formatter.rb:3658:in `push_node'
     # ./lib/rufo/formatter.rb:521:in `block in visit_exps'
     # ./lib/rufo/formatter.rb:502:in `each'
     # ./lib/rufo/formatter.rb:502:in `each_with_index'
     # ./lib/rufo/formatter.rb:502:in `visit_exps'
     # ./lib/rufo/formatter.rb:198:in `visit'
     # ./lib/rufo/formatter.rb:176:in `format'
     # ./lib/rufo/formatter.rb:14:in `format'
     # ./spec/lib/rufo/formatter_spec.rb:43:in `block (3 levels) in assert_source_specs'
lparry added a commit to lparry/rufo that referenced this issue Feb 11, 2019
gingermusketeer added a commit that referenced this issue Feb 12, 2019
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

1 participant