diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-05 14:05:52 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-05 14:05:52 +0000 |
commit | 652e695a384563e0f96adc70d16ff53a3567451a (patch) | |
tree | b69609f055f9fc87d053984fc2b0e7f44663ee95 /test | |
parent | 82031fa8449ccc351da2e2c857d26be92c2cc281 (diff) |
merge revision(s) 60980,60984: [Backport #14070]
Modules should not have subclasses.
When refining a module, the module was set to the superclass of its refinement,
and a segmentation fault occurred.
The superclass of the refinement should be an iclass of the module.
[ruby-core:83617] [Bug #14070]
The superclass of a refinement should have BasicObject as its ancestor.
Otherwise, VM_ASSERT(callable_method_entry_p(cme)) in
prepare_callable_method_entry() fails if VM_CHECK_MODE is 2.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_refinement.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb index ba7691335f..881146cfe0 100644 --- a/test/ruby/test_refinement.rb +++ b/test/ruby/test_refinement.rb @@ -1961,6 +1961,25 @@ class TestRefinement < Test::Unit::TestCase end end + def test_refining_module_repeatedly + bug14070 = '[ruby-core:83617] [Bug #14070]' + assert_in_out_err([], <<-INPUT, ["ok"], [], bug14070) + 1000.times do + Class.new do + include Enumerable + end + + Module.new do + refine Enumerable do + def foo + end + end + end + end + puts "ok" + INPUT + end + private def eval_using(mod, s) |