[前][次][番号順一覧][スレッド一覧]

ruby-changes:38349

From: nobu <ko1@a...>
Date: Wed, 6 May 2015 22:50:22 +0900 (JST)
Subject: [ruby-changes:38349] nobu:r50430 (trunk): vm_eval.c: undefined refined check_funcall

nobu	2015-05-06 22:49:57 +0900 (Wed, 06 May 2015)

  New Revision: 50430

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50430

  Log:
    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]

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_refinement.rb
    trunk/vm_eval.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50429)
+++ ChangeLog	(revision 50430)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed May  6 22:49:54 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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@g...>
 
 	* ext/-test-/file/fs.c: need to include sys/statvfs.h
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 50429)
+++ vm_eval.c	(revision 50430)
@@ -559,7 +559,8 @@ rb_method_call_status(rb_thread_t *th, c https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L559
     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;
Index: test/ruby/test_refinement.rb
===================================================================
--- test/ruby/test_refinement.rb	(revision 50429)
+++ test/ruby/test_refinement.rb	(revision 50430)
@@ -1428,6 +1428,23 @@ class TestRefinement < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_refinement.rb#L1428
     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)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]