Issue #8546 has been updated by headius (Charles Nutter).


I don't see how it would know the order in which to do the super logic. What do you expect to happen?

First off, if the "supering" M was actually included into O, there would still be nothing to super to since its method would be above O's. So I assume you don't want the Method-based "super" to error the same way.

If you would expect the "supering" hello to call O's hello, I'd like to see some justification. That would emulate behavior as if M had been prepended on to O. As it stands, M and O have no hierarchical relationship at all.

I don't think there's other possibilities. What do you want it to do?
----------------------------------------
Feature #8546: super errors in UnboundMethods
https://bugs.ruby-lang.org/issues/8546#change-40097

Author: saturnflyer (Jim Gay)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


=begin
(({UnboundMethod}))s 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.
=end



-- 
http://bugs.ruby-lang.org/