mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
vm_method.c: alias warning at refined method
* vm_method.c (rb_method_entry_make): suppress a warning at refined method which will not be redefined. [ruby-core:82385] [Bug #13817] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3fa2183614
commit
0db193f98d
2 changed files with 18 additions and 0 deletions
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue