Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6RC1
    • Fix Version/s: JRuby 1.6
    • Component/s: Parser, Ruby 1.9.2
    • Labels:
      None
    • Environment:
      win 7,jdk6_23,jruby 1.6 rc1,JRUBY_OPTS = --1.9 ,RAILS 3.0.1
    • Number of attachments :
      0

      Description

      my rails app uses oracle-enhanced(https://github.com/rsim/oracle-enhanced). in ruby 1.87,it's ok. when i set JRUBY_OPTS = --1.9, it shows follow error:

      ..lib/active_record/connection_adapters/oracle_enhanced_context_index.rb:132: syntax error, unexpected kDO_BLOCK
      

        Issue Links

          Activity

          Hide
          Hiro Asari added a comment -

          Changed the summary and components after investigating a little bit. Also fixed description somewhat.

          Show
          Hiro Asari added a comment - Changed the summary and components after investigating a little bit. Also fixed description somewhat.
          Hide
          Hiro Asari added a comment -

          I can't tell which version of the gem you're using, so I just pulled the most up-to-date version of oracle_context_index.rb and ran it through jruby --1.9 -c to see what's going on.

          The output is:

          SyntaxError in jruby-5359.rb:148: syntax error, unexpected kDO_BLOCK
          
                      selected_columns.map do |cols|
                                             ^
          

          See https://github.com/rsim/oracle-enhanced/blob/32bfae13efceca967d3569b2bb646484c5efb521/lib/active_record/connection_adapters/oracle_enhanced_context_index.rb#L148

          Now, we need a smaller test case, and here's what I've come up with:

          minimal.rb
          a b("#{}
          #{
          [].c do
          end
          }"
          )
          

          I am more or less convinced that this is a minimal case to produce this syntax error in 1.9 mode (but not in 1.8 mode). If you do any of the following, the syntax error goes away:

          1. remove a (or b, for that matter)
          2. remove the first #{}
          3. change the empty array to a name, say ary
          4. change the empty array to an empty hash
          5. replace the do block to braces

          Strange.

          Show
          Hiro Asari added a comment - I can't tell which version of the gem you're using, so I just pulled the most up-to-date version of oracle_context_index.rb and ran it through jruby --1.9 -c to see what's going on. The output is: SyntaxError in jruby-5359.rb:148: syntax error, unexpected kDO_BLOCK selected_columns.map do |cols| ^ See https://github.com/rsim/oracle-enhanced/blob/32bfae13efceca967d3569b2bb646484c5efb521/lib/active_record/connection_adapters/oracle_enhanced_context_index.rb#L148 Now, we need a smaller test case, and here's what I've come up with: minimal.rb a b("#{} #{ [].c do end }" ) I am more or less convinced that this is a minimal case to produce this syntax error in 1.9 mode (but not in 1.8 mode). If you do any of the following, the syntax error goes away: remove a (or b , for that matter) remove the first #{} change the empty array to a name, say ary change the empty array to an empty hash replace the do block to braces Strange.
          Hide
          Thomas E Enebo added a comment -

          I think this is a minimal test case:

          puts <<-EOS
          #{proc do; end}
          EOS
          

          or in terms of an ordinary dstr:

          puts "#{proc do; end}"
          

          I can say with a very high level of confidence this is a parser bug.

          Show
          Thomas E Enebo added a comment - I think this is a minimal test case: puts <<-EOS #{proc do; end} EOS or in terms of an ordinary dstr: puts "#{proc do; end}" I can say with a very high level of confidence this is a parser bug.
          Hide
          Thomas E Enebo added a comment -

          Oh...I should add that this only affects do...end blocks... {} seems to be ok.

          Show
          Thomas E Enebo added a comment - Oh...I should add that this only affects do...end blocks... {} seems to be ok.
          Hide
          Thomas E Enebo added a comment -

          Fixed in commit 758f54f on master. Spec added on rubyspec in commit c681dc8.

          Show
          Thomas E Enebo added a comment - Fixed in commit 758f54f on master. Spec added on rubyspec in commit c681dc8.

            People

            • Assignee:
              Thomas E Enebo
              Reporter:
              yang jiandong
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: