Project

General

Profile

Bug #9443

Updated by nobu (Nobuyoshi Nakada) almost 6 years ago

I am unsure if this is related to https://bugs.ruby-lang.org/issues/7842 as that issue specifically mentions the user of "super" which my example code does not use. Anyway, here is the test to recreate:

```ruby
require 'test/unit'

module A
def foo
'foo2'
end
end

class B
def foo
'foo1'
end
alias_method :bar, :foo
end

B.send(:prepend, A)

class AliasTest < Test::Unit::TestCase
def test_no_alias
assert_equal 'foo2', B.new.foo
end

def test_with_alias
assert_equal 'foo2', B.new.bar
end
end
```


`test_with_alias` test_with_alias fails and will only call the original "foo" method.

I have confirmed this on Ruby 2.0.0-p353 & 2.1.0

Back