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

Reincluded modules do not splice changes into hierarchy in the correct order #1938

Closed
headius opened this issue Sep 1, 2014 · 2 comments
Closed

Comments

@headius
Copy link
Member

@headius headius commented Sep 1, 2014

Title is a mouthful, but the basic issue is that if a module is included, then modified by including other modules into itself, then included again, the new includes don't get spliced into the target hierarchy correctly.

The following example shows that the order of modules is different from MRI:

Output:

[--dev]
~/projects/jruby $ rvm ruby-2.1 do ruby blah.rb
in Z
in A
in Q

[--dev]
~/projects/jruby $ jruby blah.rb
in A
in Z
in Q

Script:

module X
end

class Q
  def foo
    puts 'in Q'
  end
end

class Y < Q
  include X
end

module A
  def foo
    puts 'in A'
    super
  end
end

module X
  include A
end

module Z
  def foo
    puts 'in Z'
    super
  end
end

class Y
  include Z
end

class Y
  include X
end

Y.new.foo

This is the likely cause of Compass/compass-rails#179.

@headius headius added this to the JRuby 1.7.16 milestone Sep 1, 2014
@headius headius added the core label Sep 1, 2014
@enebo enebo removed this from the JRuby 1.7.16 milestone Sep 24, 2014
@tamird
Copy link

@tamird tamird commented Feb 24, 2015

@headius was this resolved by #2002?

@kares
Copy link
Member

@kares kares commented Jan 7, 2016

just checked - this works in JRuby 1.7.22 but still fails in 9K (9.0.4.0)

@kares kares added the JRuby 9000 label Jan 7, 2016
MSNexploder added a commit to MSNexploder/jruby that referenced this issue Jun 1, 2017
…clusion order (fixes jruby#1938)
@headius headius closed this in a7aef67 Jun 6, 2017
@headius headius added this to the JRuby 9.1.11.0 milestone Jun 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.