vm_eval.c: undefined refined check_funcall

* vm_eval.c (rb_method_call_status): undefined refined method is
  not callable unless using.  [ruby-core:69064] [Bug #11117]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-05-06 13:49:57 +00:00
parent 3d680dd2c4
commit a870f4fcfd
3 changed files with 24 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Wed May 6 22:49:54 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_eval.c (rb_method_call_status): undefined refined method is
not callable unless using. [ruby-core:69064] [Bug #11117]
Sun May 3 22:40:06 2015 Rei Odaira <Rei.Odaira@gmail.com>
* ext/-test-/file/fs.c: need to include sys/statvfs.h

View File

@ -1428,6 +1428,23 @@ class TestRefinement < Test::Unit::TestCase
INPUT
end
def test_check_funcall_undefined
bug11117 = '[ruby-core:69064] [Bug #11117]'
x = Class.new
Module.new do
refine x do
def to_regexp
//
end
end
end
assert_nothing_raised(NoMethodError, bug11117) {
assert_nil(Regexp.try_convert(x.new))
}
end
private
def eval_using(mod, s)

View File

@ -559,7 +559,8 @@ rb_method_call_status(rb_thread_t *th, const rb_method_entry_t *me, call_type sc
ID oid;
int noex;
if (UNDEFINED_METHOD_ENTRY_P(me)) {
if (UNDEFINED_METHOD_ENTRY_P(me) ||
UNDEFINED_REFINED_METHOD_P(me->def)) {
return scope == CALL_VCALL ? NOEX_VCALL : 0;
}
klass = me->klass;