1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

invalidate negative cache any time.

negative cache on a class which does not have subclasses was not
invalidated, but it should be invalidated because other classes
can cache this negative cache.
[Bug #17553]
This commit is contained in:
Koichi Sasada 2021-02-19 14:57:59 +09:00
parent d260cbe295
commit 9c769575bf
Notes: git 2021-02-19 16:54:53 +09:00
2 changed files with 16 additions and 7 deletions

View file

@ -61,5 +61,16 @@ class TestMethodCache < Test::Unit::TestCase
assert_equal :c2, c3.new.foo
end
def test_negative_cache_with_and_without_subclasses
c0 = Class.new{}
c1 = Class.new(c0){}
c0.new.foo rescue nil
c1.new.foo rescue nil
c1.module_eval{ def foo = :c1 }
c0.module_eval{ def foo = :c0 }
assert_equal :c0, c0.new.foo
end
end