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

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

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

Comments

@jsyeo
Copy link
Contributor

jsyeo commented Sep 24, 2016

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
Copy link
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
Copy link
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
Copy link
Member

headius commented Sep 26, 2016

Test case added in ruby/ruby@fbaa823.

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