[前][次][番号順一覧][スレッド一覧]

ruby-changes:69458

From: Shugo <ko1@a...>
Date: Tue, 26 Oct 2021 19:37:17 +0900 (JST)
Subject: [ruby-changes:69458] 37395ffa05 (master): Make the metaclass of Refinement explicitly

https://git.ruby-lang.org/ruby.git/commit/?id=37395ffa05

From 37395ffa05f04f90e34f18c6d59c9bd9ec1df292 Mon Sep 17 00:00:00 2001
From: Shugo Maeda <shugo@r...>
Date: Tue, 26 Oct 2021 19:34:27 +0900
Subject: Make the metaclass of Refinement explicitly

Otherwise, singleton methods of Module are not inherited unless
Refinement.singleton_class is called.
---
 class.c                      | 2 ++
 test/ruby/test_refinement.rb | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/class.c b/class.c
index c997b0b1721..8b0bfb83875 100644
--- a/class.c
+++ b/class.c
@@ -689,6 +689,8 @@ Init_class_hierarchy(void) https://github.com/ruby/ruby/blob/trunk/class.c#L689
     RBASIC_SET_CLASS(rb_cObject, rb_cClass);
     RBASIC_SET_CLASS(rb_cRefinement, rb_cClass);
     RBASIC_SET_CLASS(rb_cBasicObject, rb_cClass);
+
+    ENSURE_EIGENCLASS(rb_cRefinement);
 }
 
 
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb
index 3dc19ce6291..19857b035c0 100644
--- a/test/ruby/test_refinement.rb
+++ b/test/ruby/test_refinement.rb
@@ -2668,6 +2668,10 @@ class TestRefinement < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_refinement.rb#L2668
     end
   end
 
+  def test_inherit_singleton_methods_of_module
+    assert_equal([], Refinement.used_modules)
+  end
+
   private
 
   def eval_using(mod, s)
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]