Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Rubinus crashes with an incorrect syntax error in 1.9 mode #1692

Closed
iblue opened this Issue · 10 comments

7 participants

@iblue

This code is a minimal snipped that allows to reproduce the bug. It runs without problems in MRI 1.9.2-p290. When executed in rubinius with RBXOPT=-X19, it fails.

class Foo
  def bar(method, *args, &block)
    self.class.send :define_method, method do |*args, &block|
      @object.send method, *args, &block
    end
  end
end
iblue@nerdpol:~/rubinius-bug$ ruby -v
rubinius 2.0.0dev (1.9.3 4e73aaf9 yyyy-mm-dd JI) [i686-pc-linux-gnu]
iblue@nerdpol:~/rubinius-bug$ RBXOPT=-X19 ruby rubinius-bug.rb 
A syntax error has occurred:
    duplicate block argument name
    near line /home/iblue/rubinius-bug/rubinius-bug.rb:3, column 60

Code:
    self.class.send :define_method, method do |*args, &block|
                                                           ^

Backtrace:
         Rubinius::Melbourne(Rubinius::Melbourne19)#syntax_error at /home/iblue/.rvm/rubies/rbx-head/runtime/19/melbourne.rbc:68
           Rubinius::Melbourne(Rubinius::Melbourne19)#parse_file at /home/iblue/.rvm/rubies/rbx-head/runtime/19/melbourne.rbc:84
                            Rubinius::Compiler::FileParser#parse at /home/iblue/.rvm/rubies/rbx-head/runtime/19/compiler/stages.rbc:235
  Rubinius::Compiler::Parser(Rubinius::Compiler::FileParser)#run at /home/iblue/.rvm/rubies/rbx-head/runtime/19/compiler/stages.rbc:217
                                          Rubinius::Compiler#run at /home/iblue/.rvm/rubies/rbx-head/runtime/19/compiler/compiler.rbc:370
                                      Rubinius::Compiler.compile at /home/iblue/.rvm/rubies/rbx-head/runtime/19/compiler/compiler.rbc:84
                               Rubinius::CodeLoader#compile_file at kernel/delta/codeloader.rb:166
                                  Rubinius::CodeLoader#load_file at kernel/delta/codeloader.rb:147
                                Rubinius::CodeLoader#load_script at kernel/delta/codeloader.rb:63
                                Rubinius::CodeLoader.load_script at kernel/delta/codeloader.rb:109
                                         Rubinius::Loader#script at kernel/loader.rb:631
                                           Rubinius::Loader#main at kernel/loader.rb:835

When run without RBXOPT=-X19, everything works.

@jc00ke
Owner

@iblue just an FYI, but we're targeting 1.9.3, not 1.9.2 anymore. Still, good find!

@steveklabnik
Collaborator

I am also seeing this with Draper.

@iblue

My stripped down reproduction code originates from draper.

@brixen
Owner

Simpler reproduction

def a(&b)
  c { |&b| }
end
@iblue

When are you going to fix this? It's the main reason that keeps us from using rubinius for our production code.

@brixen
Owner

Soon? Patches welcome :)

@IPGlider IPGlider closed this in d4b6901
@IPGlider
Collaborator

@iblue, @steveklabnik This should be fixed now.

@IPGlider
Collaborator

@brixen, @dbussink I have done some test after my last commit and found that it solves the duplicate block argument name by reproducing the same behavior than MRI parser but more bugs arise.

git clone https://github.com/jcasimir/draper.git
cd draper
git checkout 782d3872
bundle install
bundle exec rake spec

Those test pass in MRI 1.9.3 but not in RBX, should we reopen this ticket or open a new one?

Also I don't know how to spec this behaviour right now, I would appreciate some help.

@dbussink
Owner

Please open a new issue with exact details on what the issue is, so including backtraces etc. and also please try to minimize the test case to make fixing it easier for us.

@Gibheer Gibheer referenced this issue from a commit in Gibheer/rubinius
@IPGlider IPGlider Check not in block. Fixes #1692 3eda54d
@roshats roshats referenced this issue from a commit in roshats/rubinius
@IPGlider IPGlider Check not in block. Fixes #1692 1e51881
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.