Project

General

Profile

Feature #8546

Updated by nobu (Nobuyoshi Nakada) over 7 years ago

`UnboundMethod`s =begin 
 (({UnboundMethod}))s are unable to call `super` 

 ~~~ruby 
 (({super})) 

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

 

   class O 
   
     def hello 
     
       puts "hello" 
     end 
   end 
 end 

 

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

 

   module M 
   
     def hello 
       super 
     super end 
   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 

Back