Project

General

Profile

Actions

Bug #18600

closed

Aliased method visibility issue on Ruby 3.1

Added by gmcgibbon (Gannon McGibbon) about 2 years ago. Updated almost 2 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:107722]

Description

It seems methods on classes that were originally private in the parent and made public in the child can no longer be aliased correctly:

class C
  public :system
  alias_method :bar, :system
  alias_method :system, :bar
end

p RUBY_VERSION
p [C.new.respond_to?(:system), C.new.respond_to?(:system, true)]

On Ruby <= 3.0.3, this returns [true, true], but on Ruby >= 3.1.0 this returns [false, true]. The aliased method seems to revert visibility to the parent.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0