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

Namespaced type with nested name reopens type in parent namespace #11181

Closed
straight-shoota opened this issue Sep 7, 2021 · 0 comments · Fixed by #11208
Closed

Namespaced type with nested name reopens type in parent namespace #11181

straight-shoota opened this issue Sep 7, 2021 · 0 comments · Fixed by #11208

Comments

@straight-shoota
Copy link
Member

straight-shoota commented Sep 7, 2021

The following code demonstrates the faulty behaviour:

class Foo::Bar
end

module Baz
  class Foo::Bar
    def baz
    end
  end
end

Baz::Foo::Bar # Error: undefined constant Baz::Foo::Bar

::Foo::Bar.new.baz # works!

Apparently, class Foo::Bar inside the Baz namespace is not actually placed in that namespace. It reopens ::Foo::Bar instead of defining Baz::Foo::Bar.

Originally reported in #11180

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant