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

5cf8f058a4c094bb708174fb43e7a387?d=identicon&s=25 nagachika (Tomoyuki Chikanaga) (Guest)
on 2013-09-27 19:17
(Received via mailing list)
Issue #1151 has been updated by nagachika (Tomoyuki Chikanaga).

Description updated
Status changed from Assigned to Closed

Thank you for your notification!
----------------------------------------
Backport #1151: Aliased methods change super logic when retrieved with
Object#method
https://bugs.ruby-lang.org/issues/1151#change-42054

Author: headius (Charles Nutter)
Status: Closed
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.