1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* vm_method.c (rb_method_entry_without_refinements): use

rb_resolve_refined_method() to search superclasses if
  me->def->orig_me is 0.  This change fixes make test-all
  TESTS="json ruby/test_refinement.rb".

* test/ruby/test_refinement.rb: related test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2012-12-10 13:02:54 +00:00
parent a263a8567a
commit fa7c4ab408
3 changed files with 29 additions and 1 deletions

View file

@ -1,3 +1,12 @@
Mon Dec 10 18:35:25 2012 Shugo Maeda <shugo@ruby-lang.org>
* vm_method.c (rb_method_entry_without_refinements): use
rb_resolve_refined_method() to search superclasses if
me->def->orig_me is 0. This change fixes make test-all
TESTS="json ruby/test_refinement.rb".
* test/ruby/test_refinement.rb: related test.
Mon Dec 10 17:59:07 2012 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/fiddle/win32/*: library ports from DL to Fiddle.

View file

@ -129,11 +129,30 @@ class TestRefinement < Test::Unit::TestCase
assert_raise(NoMethodError) { foo.z }
end
module RespondTo
class Super
def foo
end
end
class Sub < Super
end
module M
refine Sub do
def foo
end
end
end
end
def test_send_should_not_use_refinements
foo = Foo.new
assert_raise(NoMethodError) { foo.send(:z) }
assert_raise(NoMethodError) { FooExtClient.send_z_on(foo) }
assert_raise(NoMethodError) { foo.send(:z) }
assert_equal(true, RespondTo::Sub.new.respond_to?(:foo))
end
def test_method_should_not_use_refinements

View file

@ -637,7 +637,7 @@ rb_method_entry_without_refinements(VALUE klass, ID id,
rb_method_entry_t *me = rb_method_entry(klass, id, &defined_class);
if (me && me->def->type == VM_METHOD_TYPE_REFINED) {
me = me->def->body.orig_me;
me = rb_resolve_refined_method(Qnil, me, &defined_class);
}
if (defined_class_ptr)
*defined_class_ptr = defined_class;