aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_module.rb
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-18 02:32:17 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-18 02:32:17 +0000
commitf211abcb9c8c82c2e70d3d20ad40883ce446d0ac (patch)
tree8b8c74b52b12fccec0eeef41c05e71cf24b5c7b0 /test/ruby/test_module.rb
parent68bac3cca4d8975d9f8ac2e4772471a30c604b12 (diff)
downloadruby-f211abcb9c8c82c2e70d3d20ad40883ce446d0ac.tar.gz
* vm_method.c (rb_method_entry_make, check_override_opt_method):
should check whether a newly created method override a optimize method in case the method is defined in a prepended module of a built-in class. [ruby-core:72226] [Bug #11836] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r--test/ruby/test_module.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 1a852f84a0..55678e42a8 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -1711,6 +1711,24 @@ class TestModule < Test::Unit::TestCase
assert_equal(0, 1 / 2)
end
+ def test_override_optmethod_after_prepend
+ bug11836 = '[ruby-core:72226] [Bug #11836]'
+ assert_separately [], %{
+ module M
+ end
+ class Fixnum
+ prepend M
+ end
+ module M
+ def /(other)
+ quo(other)
+ end
+ end
+ assert_equal(1 / 2r, 1 / 2, "#{bug11836}")
+ }, ignore_stderr: true
+ assert_equal(0, 1 / 2)
+ end
+
def test_prepend_visibility
bug8005 = '[ruby-core:53106] [Bug #8005]'
c = Class.new do