[ruby-core:120213] [Ruby master Bug#20948] Constant references incorrectly cached in `module (expr)::Foo`
From:
"mame (Yusuke Endoh) via ruby-core" <ruby-core@...>
Date:
2024-12-12 11:22:07 UTC
List:
ruby-core #120213
Issue #20948 has been reported by mame (Yusuke Endoh).
----------------------------------------
Bug #20948: Constant references incorrectly cached in `module (expr)::Foo`
https://bugs.ruby-lang.org/issues/20948
* Author: mame (Yusuke Endoh)
* Status: Assigned
* Assignee: ko1 (Koichi Sasada)
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
```ruby
module M1
module Foo
X = 1
end
end
module M2
module Foo
X = 2
end
end
[M1, M2].each do
module it::Foo
p X #=> expected: prints "1" then "2"; actual: prints "1" twice
end
end
````
To be honest, I don't think it's worth slowing down the processor for this, but I create a ticket since I discovered it and since ko1 seemed to have a bit of an idea of how to solve it.
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/