ruby-changes:37656
From: usa <ko1@a...>
Date: Wed, 25 Feb 2015 14:42:55 +0900 (JST)
Subject: [ruby-changes:37656] usa:r49737 (ruby_2_0_0): merge revision(s) 49322: [Backport #10753]
usa 2015-02-25 14:42:47 +0900 (Wed, 25 Feb 2015) New Revision: 49737 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49737 Log: merge revision(s) 49322: [Backport #10753] * vm_method.c (check_definition): Module#public_method_defined?, Module#private_method_defined?, Module#protected_method_defined? should not use refinements. [ruby-core:67656] [Bug #10753] Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/test/ruby/test_refinement.rb branches/ruby_2_0_0/version.h branches/ruby_2_0_0/vm_method.c Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 49736) +++ ruby_2_0_0/ChangeLog (revision 49737) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Wed Feb 25 14:41:01 2015 Seiei Higa <hanachin@g...> + + * vm_method.c (check_definition): Module#public_method_defined?, + Module#private_method_defined?, Module#protected_method_defined? + should not use refinements. [ruby-core:67656] [Bug #10753] + Wed Feb 25 14:29:19 2015 Nobuyoshi Nakada <nobu@r...> * ext/sdbm/_sdbm.c: include ruby/ruby.h for PRIdPTRDIFF when a Index: ruby_2_0_0/vm_method.c =================================================================== --- ruby_2_0_0/vm_method.c (revision 49736) +++ ruby_2_0_0/vm_method.c (revision 49737) @@ -1009,7 +1009,7 @@ check_definition(VALUE mod, VALUE mid, r https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_method.c#L1009 const rb_method_entry_t *me; ID id = rb_check_id(&mid); if (!id) return Qfalse; - me = rb_method_entry(mod, id, 0); + me = rb_method_entry_without_refinements(mod, id, 0); if (me) { if (VISI_CHECK(me->flag, noex)) return Qtrue; Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 49736) +++ ruby_2_0_0/version.h (revision 49737) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2015-02-25" -#define RUBY_PATCHLEVEL 639 +#define RUBY_PATCHLEVEL 640 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 2 Index: ruby_2_0_0/test/ruby/test_refinement.rb =================================================================== --- ruby_2_0_0/test/ruby/test_refinement.rb (revision 49736) +++ ruby_2_0_0/test/ruby/test_refinement.rb (revision 49737) @@ -1043,6 +1043,83 @@ class TestRefinement < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_refinement.rb#L1043 end; end + def test_refined_method_defined + assert_separately([], <<-"end;") + $VERBOSE = nil + bug10753 = '[ruby-core:67656] [Bug #10753]' + + c = Class.new do + def refined_public; end + def refined_protected; end + def refined_private; end + + public :refined_public + protected :refined_protected + private :refined_private + end + + m = Module.new do + refine(c) do + def refined_public; end + def refined_protected; end + def refined_private; end + + public :refined_public + protected :refined_protected + private :refined_private + end + end + + using m + + assert_equal(true, c.public_method_defined?(:refined_public), bug10753) + assert_equal(false, c.public_method_defined?(:refined_protected), bug10753) + assert_equal(false, c.public_method_defined?(:refined_private), bug10753) + + assert_equal(false, c.protected_method_defined?(:refined_public), bug10753) + assert_equal(true, c.protected_method_defined?(:refined_protected), bug10753) + assert_equal(false, c.protected_method_defined?(:refined_private), bug10753) + + assert_equal(false, c.private_method_defined?(:refined_public), bug10753) + assert_equal(false, c.private_method_defined?(:refined_protected), bug10753) + assert_equal(true, c.private_method_defined?(:refined_private), bug10753) + end; + end + + def test_undefined_refined_method_defined + assert_separately([], <<-"end;") + $VERBOSE = nil + bug10753 = '[ruby-core:67656] [Bug #10753]' + + c = Class.new + + m = Module.new do + refine(c) do + def undefined_refined_public; end + def undefined_refined_protected; end + def undefined_refined_private; end + public :undefined_refined_public + protected :undefined_refined_protected + private :undefined_refined_private + end + end + + using m + + assert_equal(false, c.public_method_defined?(:undefined_refined_public), bug10753) + assert_equal(false, c.public_method_defined?(:undefined_refined_protected), bug10753) + assert_equal(false, c.public_method_defined?(:undefined_refined_private), bug10753) + + assert_equal(false, c.protected_method_defined?(:undefined_refined_public), bug10753) + assert_equal(false, c.protected_method_defined?(:undefined_refined_protected), bug10753) + assert_equal(false, c.protected_method_defined?(:undefined_refined_private), bug10753) + + assert_equal(false, c.private_method_defined?(:undefined_refined_public), bug10753) + assert_equal(false, c.private_method_defined?(:undefined_refined_protected), bug10753) + assert_equal(false, c.private_method_defined?(:undefined_refined_private), bug10753) + end; + end + private def eval_using(mod, s) Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r49322 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/