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

Class with prepended module is its own superclass #3276

Closed
martinsvalin opened this issue Aug 23, 2015 · 0 comments
Closed

Class with prepended module is its own superclass #3276

martinsvalin opened this issue Aug 23, 2015 · 0 comments

Comments

@martinsvalin
Copy link

When a class has prepended a module, the superclass is reported as itself.

module M; end
class C
  prepend M
end

C.superclass
# => C (in JRuby 9.0.0.0)
# => Object (in MRI 2.2.3)

I had a look here: https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/RubyClass.java#L1119

It looks as though we are walking up the inheritance chain and returning the first non-module we find.

benlovell added a commit to benlovell/rubyspec that referenced this issue Aug 23, 2015
This is mainly for jruby/jruby#3276, but also seemed somewhat
unspecified for CRuby - or at least based on my searching through
rubyspec.
benlovell added a commit to benlovell/rubyspec that referenced this issue Aug 24, 2015
This is mainly for jruby/jruby#3276, but also seemed somewhat
unspecified for CRuby - or at least based on my searching through
rubyspec.
@kares kares added this to the JRuby 9.0.1.0 milestone Aug 26, 2015
@kares kares closed this as completed in 2008589 Aug 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants