diff options
author | Koichi Sasada <[email protected]> | 2020-03-11 02:45:49 +0900 |
---|---|---|
committer | Koichi Sasada <[email protected]> | 2020-03-11 02:50:44 +0900 |
commit | 2943ff9d4441485a18773aa745bab7f47767dde2 (patch) | |
tree | af02635e8f3629930d572fb22f1517952c4672e1 /test/ruby/test_inlinecache.rb | |
parent | ec78b8b62a84fd57eb93d7b5de5b83ea517ad7c4 (diff) |
fix bug on method cache invalidation.
To invalidate cached method entry, existing method entry (ment)
is marked as invalidated and replace with copied ment. However,
complemented method entry (method entries in Module) should not
be set to Module's m_tbl.
[Bug #16669]
Diffstat (limited to 'test/ruby/test_inlinecache.rb')
-rw-r--r-- | test/ruby/test_inlinecache.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/ruby/test_inlinecache.rb b/test/ruby/test_inlinecache.rb index 90d0189d4c..6c2d86aefd 100644 --- a/test/ruby/test_inlinecache.rb +++ b/test/ruby/test_inlinecache.rb @@ -61,4 +61,50 @@ class TestMethod < Test::Unit::TestCase assert_equal :E, test[] EOS end + + def test_module_methods_redefiniton + m0 = Module.new do + def foo + super + end + end + + c1 = Class.new do + def foo + :C1 + end + end + + c2 = Class.new do + def foo + :C2 + end + end + + d1 = Class.new(c1) do + include m0 + end + + d2 = Class.new(c2) do + include m0 + end + + assert_equal :C1, d1.new.foo + + m = Module.new do + def foo + super + end + end + + d1.class_eval do + include m + end + + d2.class_eval do + include m + end + + assert_equal :C2, d2.new.foo + end end |