Project

General

Profile

Actions

Bug #12761

closed

Ruby 2.3.1 has a bug in `Module#alias` and `Module#alias_method`

Added by mudasobwa (Alexei Matyushkin) about 8 years ago. Updated over 7 years ago.

Status:
Closed
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]
[ruby-core:77271]

Description

Consider the following code:

    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__.

Surprisingly enough, the code above does not work as expected in Ruby 2.3.1:

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

The same happens for alias as well.


Related issues 2 (0 open2 closed)

Related to Ruby master - Bug #12176: method equality of aliased methods breakage on 2.3ClosedActions
Related to Ruby master - Bug #11964: __callee__ in aliased methods defined in a module returns an incorrect valueClosedko1 (Koichi Sasada)Actions
Actions #1

Updated by shyouhei (Shyouhei Urabe) about 8 years ago

  • Related to Bug #12176: method equality of aliased methods breakage on 2.3 added
Actions #2

Updated by shyouhei (Shyouhei Urabe) about 8 years ago

  • Related to Bug #11964: __callee__ in aliased methods defined in a module returns an incorrect value added

Updated by shyouhei (Shyouhei Urabe) about 8 years ago

IMHO this is a known bug yet to be fixed.

Updated by litmon (Fukuo Kadota) over 7 years ago

This is resolved version ruby-2.4.1.

Updated by shyouhei (Shyouhei Urabe) over 7 years ago

  • Status changed from Open to Closed

Closing. Thank you for confirmation.

Actions #6

Updated by usa (Usaku NAKAMURA) over 7 years ago

  • Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.2: DONTNEED, 2.3: DONE
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0