Hi @mame, I agree that the change from warning to NameError is intended, and this behavior change is not the concern: > I don't think is a problem for 2.5. The overall behavior seems consistent with 2.4, if surprising. My surprise ...RickHull (Rick Hull)
I edited the title of this issue. I reported this initially as 2.5.0 issue, as I discovered it while playing around with the 2.5.0 changes regarding toplevel constant lookup. Now, this ticket is more about surprising behavior in genera...RickHull (Rick Hull)
After some clarifying discussions with @matthewd, I don't think is a problem for 2.5. The overall behavior seems consistent with 2.4, if surprising. My surprise mostly revolves around the strange correspondence of toplevel with Object....RickHull (Rick Hull)
Further down the rabbit hole, ruby 2.4.0p0: ~~~ ruby class BasicObject X = 1 end String::X #=> 1 class Object X = 2 end String::X #=> 2 # warning: toplevel constant X referenced by String::X ~~~ On ruby 2.5.0-...RickHull (Rick Hull)
Behavior on 2.4.0p0: ~~~ ruby module Kernel X = 1 end String::X #=> 1 X = 2 String::X #=> 2 # warning: toplevel constant X referenced by String::X ~~~ ~~~ ruby class Object X = 1 end String.superclass #=> Ob...RickHull (Rick Hull)
Expected behavior: `String::X` should continue to evaluate to `1` after `X = 2` at the toplevel Actual behavior: `String::X` results in NameError after `X = 2` at the toplevel more strangeness: ~~~ ruby class Object X = 1 e...RickHull (Rick Hull)