Actions
Bug #21978
closedFix class variable cache isn't invalidated via modules
Bug #21978:
Fix class variable cache isn't invalidated via modules
Description
module M; @@x = 1; end
class A; end
class B < A
include M
def self.x; @@x; end
end
B.x # warm cache
A.class_variable_set(:@@x, 2)
B.x
The last call to B.x should fail with Should raise: class variable @@x of M is overtaken by A (RuntimeError), but has been returning 1 since since ruby-3.2.0-preview3.
It should be solvable by by bumping the global state counter more aggressively: https://github.com/ruby/ruby/pull/16551
Actions