Skip to content

Changing method visibility changes super_method for module-inherited methods #7344

@evaniainbrooks

Description

@evaniainbrooks

Follow-up to #7240

Environment Information

JRuby 9.3.4.0

module A
  private
  def derp message
    puts [message, ' from A'].join
  end
end

module B
  private
  def derp
    puts 'from B'
    super("superclass")
    puts "subclass"
  end
end

class C
  include A
  include B
end

pp C.instance_method(:derp).super_method
# <UnboundMethod: A#derp>
C.send(:public, :derp)
pp C.instance_method(:derp).super_method
# <UnboundMethod: B#derp>

Expected behavior: C.instance_method(:derp).super_method should not change from A#derp to B#derp after changing method visibility,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions