seattlerb/ruby_parser

Should parse Interpolated Array of symbols literal

strviola opened this issue · 1 comments

Test case:

require 'ruby_parser'
Ruby25Parser.new.parse('%I[#{foo}]')
# RuntimeError: not yet 24 nil => nil
# from /Users/(my_name)/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/ruby_parser-3.11.0/lib/ruby_parser_extras.rb:23:in `debug20'

Same error occurs in other Ruby versions.

Fixed:

  def test_symbol_list
    rb = '%I[#{a} #{b}]'
    pt = s(:array,
           s(:dsym, "", s(:evstr, s(:call, nil, :a))),
           s(:dsym, "", s(:evstr, s(:call, nil, :b))))

    assert_parse rb, pt
  end