From: "jeremyevans0 (Jeremy Evans)" Date: 2022-02-22T21:38:05+00:00 Subject: [ruby-core:107724] [Ruby master Bug#18600] Aliased method visibility issue on Ruby 3.1 Issue #18600 has been updated by jeremyevans0 (Jeremy Evans). Thanks for the report. I bisected this to commit:71c746379d5872e250d90ae45c585760afaf9516 (which looks like it matches the 4149 PR @byroot reported). That commit was done for performance, so we probably don't want to just revert it. It probably needs a tweak to make sure the visibility is set correctly in this corner case. ---------------------------------------- Bug #18600: Aliased method visibility issue on Ruby 3.1 https://bugs.ruby-lang.org/issues/18600#change-96647 * Author: gmcgibbon (Gannon McGibbon) * Status: Open * Priority: Normal * ruby -v: 3.1.0 * Backport: 2.6: DONTNEED, 2.7: DONTNEED, 3.0: DONTNEED, 3.1: UNKNOWN ---------------------------------------- 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. -- https://bugs.ruby-lang.org/ Unsubscribe: