diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-24 01:31:16 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-24 01:31:16 +0000 |
commit | 6cbbe85481f4bc9b73d3ac773ca64d6e029c64bb (patch) | |
tree | c3775efd5a274dc1d62a0f057fdb79d3a7cff032 /test | |
parent | 9afc6729e0d2e1aa279abf2036a02b8686379fde (diff) |
merge revision(s) 49685,49687: [Backport #10885]
* vm_insnhelper.c (rb_vm_rewrite_cref_stack): copy nd_refinements
of orignal crefs. It fixes segmentation fault when calling
refined method in duplicate module. [ruby-dev:48878] [Bug #10885]
* vm_core.h, class.c: change accordingly.
* test/ruby/test_refinement.rb: add a test for above.
of original crefs. It fixes segmentation fault when calling
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@49708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_refinement.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb index 3d703e5a3b..1078209af3 100644 --- a/test/ruby/test_refinement.rb +++ b/test/ruby/test_refinement.rb @@ -1387,6 +1387,34 @@ class TestRefinement < Test::Unit::TestCase :foo, bug10826) end + def test_call_refined_method_in_duplicate_module + bug10885 = '[ruby-dev:48878]' + assert_in_out_err([], <<-INPUT, [], [], bug10885) + module M + refine Object do + def raise + # do nothing + end + end + + class << self + using M + def m0 + raise + end + end + + using M + def M.m1 + raise + end + end + + M.dup.m0 + M.dup.m1 + INPUT + end + private def eval_using(mod, s) |