зеркало из https://github.com/github/ruby.git
vm_method.c: fix change refined new method visibility
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
759a31b4a3
Коммит
459894160e
|
@ -1,3 +1,7 @@
|
|||
Thu Jan 8 16:31:43 2015 Seiei Higa <hanachin@gmail.com>
|
||||
|
||||
|
||||
|
||||
Thu Jan 8 12:53:44 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* dir.c (glob_helper): match in case-folding only if the directory
|
||||
|
|
|
@ -1165,6 +1165,20 @@ class TestRefinement < Test::Unit::TestCase
|
|||
end;
|
||||
end
|
||||
|
||||
def test_change_refined_new_method_visibility
|
||||
assert_separately([], <<-"end;")
|
||||
bug10706 = '[ruby-core:67387] [Bug #10706]'
|
||||
module RefinementBug
|
||||
refine Object do
|
||||
def foo
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
assert_raise(NameError, bug10706) {private(:foo)}
|
||||
end;
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def eval_using(mod, s)
|
||||
|
|
|
@ -825,7 +825,9 @@ rb_export_method(VALUE klass, ID name, rb_method_flag_t noex)
|
|||
me = search_method(rb_cObject, name, &defined_class);
|
||||
}
|
||||
|
||||
if (UNDEFINED_METHOD_ENTRY_P(me)) {
|
||||
if (UNDEFINED_METHOD_ENTRY_P(me) ||
|
||||
(me->def->type == VM_METHOD_TYPE_REFINED &&
|
||||
UNDEFINED_METHOD_ENTRY_P(me->def->body.orig_me))) {
|
||||
rb_print_undef(klass, name, 0);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче