Project

General

Profile

Actions

Feature #8546

closed

super errors in UnboundMethods

Added by saturnflyer (Jim Gay) almost 11 years ago. Updated over 9 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:<unknown>]

Description

UnboundMethods are unable to call super

module M
  def hello
    puts "hello from M"
  end
end

class O
  def hello
    puts "hello"
  end
end

o = O.new
o.hello #=> "hello"
M.instance_method(:hello).bind(o).call #=> "hello from M"

module M
  def hello
    super
  end
end

M.instance_method(:hello).bind(o).call #=> TypeError: self has wrong type to call super in this context: O (expected M)}))

Given that the non-super method works, I would expect super to work.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0