diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | test/ruby/test_refinement.rb | 25 |
2 files changed, 31 insertions, 0 deletions
@@ -1,3 +1,9 @@ +Sat Nov 5 11:53:02 2016 Shugo Maeda <shugo@ruby-lang.org> + + * test/ruby/test_refinement.rb (test_refine_alias_in_subclass): + add a test to check that alias in subclasses can be refined. + [ruby-core:69374] [Bug #11186] + Sat Nov 5 11:20:57 2016 Shugo Maeda <shugo@ruby-lang.org> * cont.c (cont_new): disable optimization if clang's version is diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb index 3b3ceb048c..5cbb11121b 100644 --- a/test/ruby/test_refinement.rb +++ b/test/ruby/test_refinement.rb @@ -1750,6 +1750,31 @@ class TestRefinement < Test::Unit::TestCase assert_equal("Foo#x", FooExtClient.return_proc(&:x).(Foo.new)) end + module AliasInSubclass + class C + def foo + :original + end + end + + class D < C + alias bar foo + end + + module M + refine D do + def bar + :refined + end + end + end + end + + def test_refine_alias_in_subclass + assert_equal(:refined, + eval_using(AliasInSubclass::M, "AliasInSubclass::D.new.bar")) + end + private def eval_using(mod, s) |