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

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

Closed
iblue opened this issue Apr 30, 2012 · 10 comments
Closed

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

iblue opened this issue Apr 30, 2012 · 10 comments

Comments

@iblue
Copy link

iblue commented Apr 30, 2012

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

jc00ke commented Apr 30, 2012

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

@steveklabnik
Copy link
Member

I am also seeing this with Draper.

@iblue
Copy link
Author

iblue commented May 12, 2012

My stripped down reproduction code originates from draper.

@hosiawak
Copy link
Member

hosiawak commented Jul 3, 2012

@brixen
Copy link
Member

brixen commented Jul 31, 2012

Simpler reproduction

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

@iblue
Copy link
Author

iblue commented Jul 31, 2012

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

@brixen
Copy link
Member

brixen commented Jul 31, 2012

Soon? Patches welcome :)

@IPGlider
Copy link
Member

IPGlider commented Aug 9, 2012

@iblue, @steveklabnik This should be fixed now.

@IPGlider
Copy link
Member

IPGlider commented Aug 9, 2012

@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
Copy link
Contributor

dbussink commented Aug 9, 2012

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 pushed a commit to Gibheer/rubinius that referenced this issue Aug 14, 2012
roshats pushed a commit to roshats/rubinius that referenced this issue Jun 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants