Calling super without args does not (always) pass original args
---------------------------------------------------------------

                 Key: JRUBY-1390
                 URL: http://jira.codehaus.org/browse/JRUBY-1390
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.x
         Environment: trunk (4406)
            Reporter: Bill Dortch
         Attachments: super_bug.rb

This is a fairly new bug, within the past week or two. I'll try to come up with 
a simpler test case, but this demonstrates the bug reliably.  I suspect this is 
a compiler bug, as it will work correctly several times before failing:
{noformat}
module M
  class << self
    def append_features(clazz)
      clazz.module_eval do
        class << self
          def inherited(subclass)
            puts "inherited: #{subclass}"
            super
          end
        end
      end
    end
  end
end

100.times do
  a = Class.new do
    include M
  end
  
  b = Class.new(a)
end

inherited: #<Class:01xcab854>
inherited: #<Class:01x14323d5>
inherited: #<Class:01x17050f5>
inherited: #<Class:01xdf2940>
inherited: #<Class:01xc789fb>
inherited: #<Class:01x122c9df>
inherited: #<Class:01x15d8d75>
inherited: #<Class:01xf2164f>
inherited: #<Class:01xbfd10a>
inherited: #<Class:01xdf4bfc>
ArgumentError: wrong number of arguments(0 for 1)
        from c:/temp/jruby_support/super_bug.rb:8:in `inherited'
        from c:/temp/jruby_support/super_bug.rb:21:in `new'
        from c:/temp/jruby_support/super_bug.rb:21:in `new'
        from (irb):1:in `times'
        from c:/temp/jruby_support/super_bug.rb:16:in `times'
        from (irb):1:in `load'
        from (irb):1:in `binding'
{noformat}
Explicitly passing subclass as an arg does work.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to