From: "Eregon (Benoit Daloze) via ruby-core" Date: 2024-12-14T22:48:40+00:00 Subject: [ruby-core:120241] [Ruby master Bug#20948] Constant references incorrectly cached in `module (expr)::Foo` Issue #20948 has been updated by Eregon (Benoit Daloze). There used to be a similar bug a while ago and IIRC some specs were added, @ko1 maybe you remember it and could link that ticket here? I think it was constants inside `class << expr` though, not inside `module expr::Foo`. ---------------------------------------- Bug #20948: Constant references incorrectly cached in `module (expr)::Foo` https://bugs.ruby-lang.org/issues/20948#change-111009 * 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/