Project

General

Profile

Actions

Bug #20948

open

Constant references incorrectly cached in `module (expr)::Foo`

Added by mame (Yusuke Endoh) 6 days ago. Updated 4 days ago.

Status:
Assigned
Target version:
-
[ruby-core:120213]

Description

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.

Actions

Also available in: Atom PDF

Like0
Like0