ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:120213] [Ruby master Bug#20948] Constant references incorrectly cached in `module (expr)::Foo`
@ 2024-12-12 11:22 mame (Yusuke Endoh) via ruby-core
  2024-12-14 22:48 ` [ruby-core:120241] " Eregon (Benoit Daloze) via ruby-core
  0 siblings, 1 reply; 2+ messages in thread
From: mame (Yusuke Endoh) via ruby-core @ 2024-12-12 11:22 UTC (permalink / raw)
  To: ruby-core; +Cc: mame (Yusuke Endoh)

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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [ruby-core:120241] [Ruby master Bug#20948] Constant references incorrectly cached in `module (expr)::Foo`
  2024-12-12 11:22 [ruby-core:120213] [Ruby master Bug#20948] Constant references incorrectly cached in `module (expr)::Foo` mame (Yusuke Endoh) via ruby-core
@ 2024-12-14 22:48 ` Eregon (Benoit Daloze) via ruby-core
  0 siblings, 0 replies; 2+ messages in thread
From: Eregon (Benoit Daloze) via ruby-core @ 2024-12-14 22:48 UTC (permalink / raw)
  To: ruby-core; +Cc: Eregon (Benoit Daloze)

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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-14 22:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-12 11:22 [ruby-core:120213] [Ruby master Bug#20948] Constant references incorrectly cached in `module (expr)::Foo` mame (Yusuke Endoh) via ruby-core
2024-12-14 22:48 ` [ruby-core:120241] " Eregon (Benoit Daloze) via ruby-core

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).