[ruby-core:80500] [Ruby trunk Bug#12761][Closed] Ruby 2.3.1 has a bug in `Module#alias` and `Module#alias_method`

From: shyouhei@...
Date: 2017-03-30 09:32:37 UTC
List: ruby-core #80500
Issue #12761 has been updated by shyouhei (Shyouhei Urabe).

Status changed from Open to Closed

Closing.  Thank you for confirmation.

----------------------------------------
Bug #12761: Ruby 2.3.1 has a bug in `Module#alias` and `Module#alias_method`
https://bugs.ruby-lang.org/issues/12761#change-64002

* Author: mudasobwa (Alexei Matyushkin)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux], ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
Consider the following code:
    
~~~ ruby
    module M
      def original ; puts __callee__ ; end
      alias_method :aliased, :original
    end
    class A
      include M
    end

    A.new.original
    #⇒ original
    A.new.aliased
    #⇒ aliased
~~~

The above code runs perfectly fine in Ruby 2.1 and returns the actual method name, as it is supposed to be done by [`Kernel#__callee__`](https://ruby-doc.org/core-2.3.1/Kernel.html#method-i-__callee__). 

Surprisingly enough, the code above _does not work as expected_ in Ruby 2.3.1:

~~~ ruby
    A.new.original
    #⇒ original
    A.new.aliased
    #⇒ original
~~~

The same happens for `alias` as well.



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

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next