* vm_method.c (rb_alias): should resolve refined methods.
[ruby-core:69360] [Bug #11182] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
37aec839d6
commit
834d2bbe4d
@ -1,3 +1,8 @@
|
|||||||
|
Tue May 26 22:10:43 2015 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
|
* vm_method.c (rb_alias): should resolve refined methods.
|
||||||
|
[ruby-core:69360] [Bug #11182]
|
||||||
|
|
||||||
Tue May 26 21:35:13 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
Tue May 26 21:35:13 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
||||||
|
|
||||||
* include/ruby/defines.h (RUBY_ATTR_ALLOC_SIZE): fix condition.
|
* include/ruby/defines.h (RUBY_ATTR_ALLOC_SIZE): fix condition.
|
||||||
|
@ -1455,6 +1455,32 @@ class TestRefinement < Test::Unit::TestCase
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_alias_refined_method2
|
||||||
|
bug11182 = '[ruby-core:69360]'
|
||||||
|
assert_in_out_err([], <<-INPUT, ["C"], [], bug11182)
|
||||||
|
class C
|
||||||
|
def foo
|
||||||
|
puts "C"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
module M
|
||||||
|
refine C do
|
||||||
|
def foo
|
||||||
|
puts "Refiend C"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class D < C
|
||||||
|
alias bar foo
|
||||||
|
end
|
||||||
|
|
||||||
|
using M
|
||||||
|
D.new.bar
|
||||||
|
INPUT
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def eval_using(mod, s)
|
def eval_using(mod, s)
|
||||||
|
@ -1303,6 +1303,9 @@ rb_alias(VALUE klass, ID name, ID def)
|
|||||||
|
|
||||||
again:
|
again:
|
||||||
orig_me = search_method(klass, def, &defined_class);
|
orig_me = search_method(klass, def, &defined_class);
|
||||||
|
if (orig_me && orig_me->def->type == VM_METHOD_TYPE_REFINED) {
|
||||||
|
orig_me = rb_resolve_refined_method(Qnil, orig_me, &defined_class);
|
||||||
|
}
|
||||||
|
|
||||||
if (UNDEFINED_METHOD_ENTRY_P(orig_me) ||
|
if (UNDEFINED_METHOD_ENTRY_P(orig_me) ||
|
||||||
UNDEFINED_REFINED_METHOD_P(orig_me->def)) {
|
UNDEFINED_REFINED_METHOD_P(orig_me->def)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user