Bug #1151: Aliased methods change super logic when retrieved with Object#method
http://redmine.ruby-lang.org/issues/show/1151

Author: Charles Nutter
Status: Open, Priority: Normal
ruby -v: 1.8.6 (all versions) and 1.8.7

This is a peculiar case I don't believe I've reported before. It seems that "method" can change the super behavior of an alias:

 # Test weird likely-a-bug where method() will repurpose where super goes to
 class Foo222
   def a; 'a'; end
   def b; 'b'; end
 end
 
 class Bar222 < Foo222
   def a; super; end
   alias b a
 end
 
 puts('a' == Bar222.new.b) # true
 puts('a' == Bar222.new.method(:b).call) # false

Ruby 1.9 behaves as you would expect, calling the "a" super method in both cases. We changed our behavior in JRuby 1.1.2 to match Ruby 1.8.6, but I still believe this is a bug. The JRuby bug report is here: http://jira.codehaus.org/browse/JRUBY-1192 and I reported it to ruby-core here: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/11600 and a patch was proposed here: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/11603. Since it behaves as I expect in 1.9, I assume the 1.8.x behavior is incorrect.


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