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

squiggly heredoc with single quotes fails to run #4169

Closed
pbl-pw opened this Issue Sep 22, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@pbl-pw

pbl-pw commented Sep 22, 2016

test code:

obj = <<~'TEST'
    hello
TEST

puts obj

report error:

Unhandled Java exception: java.lang.ClassCastException: org.jruby.util.ByteList cannot be cast to org.jruby.ast.Node
java.lang.ClassCastException: org.jruby.util.ByteList cannot be cast to org.jruby.ast.Node
                     execute at org/jruby/parser/RubyParser.java:4501
                     yyparse at org/jruby/parser/RubyParser.java:1678
                     yyparse at org/jruby/parser/RubyParser.java:1569
                       parse at org/jruby/parser/RubyParser.java:5359
                       parse at org/jruby/parser/Parser.java:121
                       parse at org/jruby/parser/Parser.java:103
          parseFileAndGetAST at org/jruby/Ruby.java:2772
  parseFileFromMainAndGetAST at org/jruby/Ruby.java:2765
           parseFileFromMain at org/jruby/Ruby.java:2753
               parseFromMain at org/jruby/Ruby.java:613
                 runFromMain at org/jruby/Ruby.java:559
               doRunFromMain at org/jruby/Main.java:425
                 internalRun at org/jruby/Main.java:313
                         run at org/jruby/Main.java:242
                        main at org/jruby/Main.java:204

but <<~TEST or <<~"TEST" both ok.

Environment

  • jruby 9.1.5.0 (2.3.1) 2016-09-07 036ce39 Java HotSpot(TM) Client VM 25.101-b13 on 1.8.0_101-b13 +jit [mswin32-x86]
  • Windows 10 x64
@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Sep 22, 2016

Member

Nice.

Member

headius commented Sep 22, 2016

Nice.

@headius headius added this to the JRuby 9.1.6.0 milestone Sep 22, 2016

@enebo enebo closed this in 9bbcd84 Sep 22, 2016

yarmiganosca added a commit to yarmiganosca/spinach that referenced this issue Aug 21, 2018

upgrade jruby to get around capybara syntax issue in jruby test runs
We routinely see an error in JRuby runs on Travis when loading the file capybara/node/actions.
The reason for this is that it contains squiggly heredocs with delimiters with quotes (<<~'JS' to be specific).
link: https://github.com/teamcapybara/capybara/blob/3.2.0/lib/capybara/node/actions.rb#L310-L331

JRuby couldn't parse squiggly heredocs with single quotes in the delimeter until 9.1.6.0.
link: jruby/jruby#4169

Because capybara isn't a runtime dependency for spinach, making our JRuby runs on Travis use a newer version of JRuby doesn't actually affect our users.
The alternative, getting capybara's maintainers to accept a PR removing the quotes from the heredoc delimeters in that file, seems like it would take much more effort, for very little benefit.

As a side note, I have no clue what the benefit of adding quotes (single or double) to a heredoc delimeter is. Those capybara heredocs work fine with or without quotes in the delimeter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment