natalie
natalie copied to clipboard
Scoping when reopening a toplevel constant
A piece of code because nobody will understand this title:
module Foo
module Bar
class ::Object
Bar
end
end
end
This works fine in MRI, where it uses the Foo::Bar
constant. In Natalie, it tries to look up ::Bar
and fails.
This structure is used in the Nesting
fixture in spec/core/module
, which causes all the module specs in the nightly test to fail (we'd also need to implement Module.nesting
, but we could just use a stub method).
Look up the exact rules for this, what happens when there is a toplevel Bar
module as well? This must be documented somewhere.