Skip to content

Double unresolved super from aliased method when compiled with indy #8944

@headius

Description

@headius

The following spec fails when the code eventually JITs and indy is enabled:

The super keyword sees the included version of a module a method is alias from

An isolated reproduction based on the spec is below:

module AS1
  def foo = :a
end

module BS1
  def foo = [:b, super]
end

class Base
  extend AS1
  extend BS1
end

class Trigger < Base
  class << self
    def foo_quux = foo_baz

    alias_method :foo_baz, :foo
    alias_method :foo, :foo_quux
  end
end

2.times { p Trigger.foo }

Output (both lines should look like the first one):

$ jruby blah.rb                                                                                             
[:b, :a]
[:b, [:b, :a]]

Something along the way causes the BS1#foo to super back into itself, most likely because the aliases invoked through indy do not properly pass through the "implementation class" where the module method with super actually lives.

This issue only affects JIT + indy and also affects 9.4 so it has been around for a while. Ultimately it was isolated while exercising specs repeatedly for #8930.

We will tag this for now and plan to fix it in 10.0.3.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions