ruby-changes:71358
From: Jeremy <ko1@a...>
Date: Fri, 11 Mar 2022 01:35:41 +0900 (JST)
Subject: [ruby-changes:71358] 0c6e24d102 (master): Fix visibility of alias of zsuper methods
https://git.ruby-lang.org/ruby.git/commit/?id=0c6e24d102 From 0c6e24d102e894a7211a596e6aa95828b1cf4406 Mon Sep 17 00:00:00 2001 From: Jeremy Evans <code@j...> Date: Tue, 22 Feb 2022 13:43:14 -0800 Subject: Fix visibility of alias of zsuper methods This was broken by 71c746379d5872e250d90ae45c585760afaf9516. Fixes [Bug #18600] --- test/ruby/test_alias.rb | 10 ++++++++++ vm_method.c | 1 + 2 files changed, 11 insertions(+) diff --git a/test/ruby/test_alias.rb b/test/ruby/test_alias.rb index 99f2223b49..0d33cb993c 100644 --- a/test/ruby/test_alias.rb +++ b/test/ruby/test_alias.rb @@ -265,6 +265,16 @@ class TestAlias < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_alias.rb#L265 end; end + class C2 + public :system + alias_method :bar, :system + alias_method :system, :bar + end + + def test_zsuper_alias_visibility + assert(C2.new.respond_to?(:system)) + end + def test_alias_memory_leak assert_no_memory_leak([], "#{<<~"begin;"}", "#{<<~'end;'}", rss: true) begin; diff --git a/vm_method.c b/vm_method.c index edbaad2396..0400aab801 100644 --- a/vm_method.c +++ b/vm_method.c @@ -2146,6 +2146,7 @@ rb_alias(VALUE klass, ID alias_name, ID original_name) https://github.com/ruby/ruby/blob/trunk/vm_method.c#L2146 visi = METHOD_ENTRY_VISI(orig_me); goto again; case VM_METHOD_TYPE_ALIAS: + visi = METHOD_ENTRY_VISI(orig_me); orig_me = orig_me->def->body.alias.original_me; VM_ASSERT(orig_me->def->type != VM_METHOD_TYPE_ALIAS); break; -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/