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

Comments

Projects
None yet
2 participants
@martinsvalin
Copy link

martinsvalin commented Aug 23, 2015

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

Specify `superclass` in respect to `prepend`
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

Specify `superclass` in respect to `prepend`
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 in 2008589 Aug 26, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.