Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scoping when reopening a toplevel constant #2269

Open
herwinw opened this issue Oct 25, 2024 · 1 comment
Open

Scoping when reopening a toplevel constant #2269

herwinw opened this issue Oct 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@herwinw
Copy link
Member

herwinw commented Oct 25, 2024

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.

@herwinw herwinw added the bug Something isn't working label Oct 25, 2024
@seven1m
Copy link
Member

seven1m commented Oct 25, 2024

Wow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants