NoMethodError: undefined method `dedent_string' when lexing squigly heredocs in Ripper #4176

Closed
jsyeo opened this Issue Sep 24, 2016 · 3 comments

Projects

None yet

2 participants

@jsyeo
jsyeo commented Sep 24, 2016 edited

Environment

» jruby --version
jruby 9.1.5.0 (2.3.1) 2016-09-07 036ce39 Java HotSpot(TM) 64-Bit Server VM 25.102-b14 on 1.8.0_102-b14 +jit [darwin-x86_64]

Expected Behavior

require 'ripper'
a = File.read 'heredoc.rb'
Ripper.lex a
__END__
[[[1, 0], :on_heredoc_beg, "<<~TEST"], [[1, 7], :on_nl, "\n"], [[2, 1], :on_tstring_content, "hello\n"], [[3, 0], :on_heredoc_end, "TEST\n"]]

Actual Behavior

require 'ripper'
a = File.read 'heredoc.rb'
Ripper.lex a
__END__
NoMethodError: undefined method `dedent_string' for #<Ripper::Lexer:0x327bcebd>
from /Users/nos/.rbenv/versions/jruby-9.1.5.0/lib/ruby/stdlib/ripper/lexer.rb:71:in `block in on_heredoc_dedent'

Here's the contents of heredoc.rb:

<<~TEST
 hello
TEST

Here's the entire stacktrace of the error:

NoMethodError: undefined method `dedent_string' for #<Ripper::Lexer:0x226b143b>
  block in on_heredoc_dedent at /Users/nos/.rbenv/versions/jruby-9.1.5.0/lib/ruby/stdlib/ripper/lexer.rb:71
                        each at org/jruby/RubyArray.java:1734
           on_heredoc_dedent at /Users/nos/.rbenv/versions/jruby-9.1.5.0/lib/ruby/stdlib/ripper/lexer.rb:69
                       parse at org/jruby/ext/ripper/RubyRipper.java:324
                       parse at /Users/nos/.rbenv/versions/jruby-9.1.5.0/lib/ruby/stdlib/ripper/lexer.rb:61
                         lex at /Users/nos/.rbenv/versions/jruby-9.1.5.0/lib/ruby/stdlib/ripper/lexer.rb:55
                         lex at /Users/nos/.rbenv/versions/jruby-9.1.5.0/lib/ruby/stdlib/ripper/lexer.rb:44
                      <main> at -e:1
@headius
Member
headius commented Sep 26, 2016

Looking into it.

This is more motivation to make jruby-ripper a default gem, so we can upgrade it without releasing JRuby proper.

@headius headius added this to the JRuby 9.1.6.0 milestone Sep 26, 2016
@headius
Member
headius commented Sep 26, 2016

Seems like this is just a missing addition from 2.3 in the Ripper class. I'll add it.

@headius
Member
headius commented Sep 26, 2016

Test case added in ruby/ruby@fbaa823.

@headius headius closed this in 21b9760 Sep 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment