Forum: Ruby-core Aliased methods change super logic when retrieved with Object#method

F1d37642fdaa1662ff46e4c65731e9ab?d=identicon&s=25 Charles Nutter (headius)
on 2013-09-27 13:21
(Received via mailing list)
Issue #1151 has been updated by headius (Charles Nutter).


I do not have permission to close this bug, but it can be closed.
----------------------------------------
Backport #1151: Aliased methods change super logic when retrieved with
Object#method
https://bugs.ruby-lang.org/issues/1151#change-42045

Author: headius (Charles Nutter)
Status: Assigned
Priority: Normal
Assignee: wyhaines (Kirk Haines)
Category:
Target version:


=begin
 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/... and a
patch was proposed here:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/.... Since
it behaves as I expect in 1.9, I assume the 1.8.x behavior is incorrect.
=end
This topic is locked and can not be replied to.