summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShugo Maeda <shugo@ruby-lang.org>2021-10-26 19:34:27 +0900
committerShugo Maeda <shugo@ruby-lang.org>2021-10-26 19:36:52 +0900
commit37395ffa05f04f90e34f18c6d59c9bd9ec1df292 (patch)
tree976481345a628df3a990a2c2092732ecdc9e63b5
parent8a49c7e4812a3f6d027dac1a574f47f125886935 (diff)
Make the metaclass of Refinement explicitly
Otherwise, singleton methods of Module are not inherited unless Refinement.singleton_class is called.
-rw-r--r--class.c2
-rw-r--r--test/ruby/test_refinement.rb4
2 files changed, 6 insertions, 0 deletions
diff --git a/class.c b/class.c
index c997b0b172..8b0bfb8387 100644
--- a/class.c
+++ b/class.c
@@ -689,6 +689,8 @@ Init_class_hierarchy(void)
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 3dc19ce629..19857b035c 100644
--- a/test/ruby/test_refinement.rb
+++ b/test/ruby/test_refinement.rb
@@ -2668,6 +2668,10 @@ class TestRefinement < Test::Unit::TestCase
end
end
+ def test_inherit_singleton_methods_of_module
+ assert_equal([], Refinement.used_modules)
+ end
+
private
def eval_using(mod, s)