aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/ruby/test_refinement.rb17
-rw-r--r--vm_method.c1
2 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb
index c7df789306..d79eb2b187 100644
--- a/test/ruby/test_refinement.rb
+++ b/test/ruby/test_refinement.rb
@@ -1944,6 +1944,23 @@ class TestRefinement < Test::Unit::TestCase
end
end
+ def test_refined_method_alias_warning
+ c = Class.new do
+ def t; :t end
+ def f; :f end
+ end
+ Module.new do
+ refine(c) do
+ alias foo t
+ end
+ end
+ assert_warning('', '[ruby-core:82385] [Bug #13817] refined method is not redefined') do
+ c.class_eval do
+ alias foo f
+ end
+ end
+ end
+
private
def eval_using(mod, s)
diff --git a/vm_method.c b/vm_method.c
index 919c238f65..f429048726 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -541,6 +541,7 @@ rb_method_entry_make(VALUE klass, ID mid, VALUE defined_class, rb_method_visibil
if (RTEST(ruby_verbose) &&
type != VM_METHOD_TYPE_UNDEF &&
(old_def->alias_count == 0) &&
+ !make_refined &&
old_def->type != VM_METHOD_TYPE_UNDEF &&
old_def->type != VM_METHOD_TYPE_ZSUPER &&
old_def->type != VM_METHOD_TYPE_ALIAS) {