Project

General

Profile

Actions

Bug #7842

closed

An alias of a "prepend"ed method skips the original method when calling super

Added by mame (Yusuke Endoh) almost 12 years ago. Updated over 10 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.0.0dev (2013-02-13 trunk 39225) [x86_64-linux]
[ruby-core:52206]

Description

Hello,

  module P
    def m; puts "P"; super; end
  end
  class A
    def m; puts "A"; end
  end
  class B < A
    def m; puts "B"; end
    prepend P
    alias m2 m
  end
  B.new.m2
    #=> expected: P, B, A
    #=> actual:   P, A

Is this intentional?
It looks weird to me that calling super of P#m (as m2) skips A#m.


Yusuke Endoh


Related issues 4 (0 open4 closed)

Related to Ruby master - Feature #7836: Need a way to get Method and UnboundMethod objects to methods overridden by prepended modulesClosedmatz (Yukihiro Matsumoto)Actions
Related to Ruby master - Bug #11189: alias prepended moduleClosedmatz (Yukihiro Matsumoto)Actions
Has duplicate Ruby master - Bug #9236: include + include + alias_method + super behaviour inconsistency between 1.9 and 2.0Closedko1 (Koichi Sasada)12/10/2013Actions
Has duplicate Ruby master - Bug #7993: owner of methods defined after using Module#prependClosed03/01/2013Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0