Project

General

Profile

Actions

Bug #6891

closed

Protected methods in a module can't call super

Added by tenderlovemaking (Aaron Patterson) over 11 years ago. Updated over 11 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.0.0dev (2012-08-19 trunk 36729) [x86_64-darwin12.0.0]
Backport:
[ruby-core:47241]

Description

Since r36616 modules that have protected methods and are extended on to another class cannot call super. Here is an example:

module A
def inherited klass
super
end
end

module B
protected

def inherited klass
super
end
end

class C
extend B
extend A
end

class Z < C
end

Before r36616 this code would work, but after r36616 this code raises an exception. I've attached a test case.


Files

test.patch (839 Bytes) test.patch tenderlovemaking (Aaron Patterson), 08/20/2012 07:07 AM
Actions #1

Updated by nobu (Nobuyoshi Nakada) over 11 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r36736.
Aaron, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


vm_insnhelper.c: iclass as klass in cfp

  • vm_insnhelper.c (vm_call_method): follow iclasses as klass in cfp
    but not included modules. [ruby-core:47241] [Bug #6891]
  • vm_insnhelper.c (vm_call_bmethod): pass defined_class to follow
    proper ancestors. [ruby-core:47241] [Bug #6891]
Actions

Also available in: Atom PDF

Like0
Like0