diff options
| author | nagachika <nagachika@ruby-lang.org> | 2024-10-18 13:10:46 +0900 |
|---|---|---|
| committer | nagachika <nagachika@ruby-lang.org> | 2024-10-18 13:57:08 +0900 |
| commit | cb75fcef6feb126a67874109ce1503976a6f90cc (patch) | |
| tree | 16693b999669827c0c554989f10a142c017d316f /test/ruby | |
| parent | 087e4ed6cc9da9cfca1a107058905446ff474bd1 (diff) | |
merge revision(s) 6118e8a47394409b53164b60e79fadf348b97db3, dc64448202299633a235f310b8bf2192263f274f: [Backport #20716]
Fix method caching bug when including/prepend module A that prepends module B
Fix by always adding the generated iclass to the subclasses list,
otherwise the method cache for the iclass is not cleared when
the method in the module is overwritten.
Fixes [Bug #20716]
Remove an unused variable
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_super.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb index 6a575b88c5..08be568660 100644 --- a/test/ruby/test_super.rb +++ b/test/ruby/test_super.rb @@ -605,6 +605,35 @@ class TestSuper < Test::Unit::TestCase } end + def test_super_with_included_prepended_module_method_caching_bug_20716 + a = Module.new do + def test(*args) + super + end + end + + b = Module.new do + def test(a) + a + end + end + + c = Class.new + + b.prepend(a) + c.include(b) + + assert_equal(1, c.new.test(1)) + + b.class_eval do + def test + :test + end + end + + assert_equal(:test, c.new.test) + end + class TestFor_super_with_modified_rest_parameter_base def foo *args args |
