Skip to content

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

@headius

Description

@headius

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions