From 7ed027a8332e6f64b2a3253f3b48c0488f1184aa Mon Sep 17 00:00:00 2001 From: Shugo Maeda Date: Tue, 19 Nov 2024 13:41:39 +0900 Subject: [PATCH] Remove deprecated method Refinement#refined_class [Feature #20901] --- NEWS.md | 4 ++++ eval.c | 16 ---------------- test/ruby/test_refinement.rb | 6 ------ 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/NEWS.md b/NEWS.md index 397660d478..5c3fa81687 100644 --- a/NEWS.md +++ b/NEWS.md @@ -51,6 +51,10 @@ Note: We're only listing outstanding class updates. #=> [2022-02-24 00:00:00 UTC, 2022-02-25 00:00:00 UTC, 2022-02-26 00:00:00 UTC] ``` +* Refinement + + * Removed deprecated method Refinement#refined_class. [[Feature #19714]] + * RubyVM::AbstractSyntaxTree * Add RubyVM::AbstractSyntaxTree::Node#locations method which returns location objects diff --git a/eval.c b/eval.c index 7fb9d35903..6224e54ef7 100644 --- a/eval.c +++ b/eval.c @@ -1403,21 +1403,6 @@ rb_refinement_module_get_refined_class(VALUE module) return rb_attr_get(module, id_refined_class); } -/* - * call-seq: - * refined_class -> class - * - * Deprecated; prefer #target. - * - * Return the class refined by the receiver. - */ -static VALUE -rb_refinement_refined_class(VALUE module) -{ - rb_warn_deprecated_to_remove("3.4", "Refinement#refined_class", "Refinement#target"); - return rb_refinement_module_get_refined_class(module); -} - static void add_activated_refinement(VALUE activated_refinements, VALUE klass, VALUE refinement) @@ -2131,7 +2116,6 @@ Init_eval(void) rb_undef_method(rb_cClass, "refine"); rb_define_private_method(rb_cRefinement, "import_methods", refinement_import_methods, -1); rb_define_method(rb_cRefinement, "target", rb_refinement_module_get_refined_class, 0); - rb_define_method(rb_cRefinement, "refined_class", rb_refinement_refined_class, 0); rb_undef_method(rb_cRefinement, "append_features"); rb_undef_method(rb_cRefinement, "prepend_features"); rb_undef_method(rb_cRefinement, "extend_object"); diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb index 913c968d35..6ce434790b 100644 --- a/test/ruby/test_refinement.rb +++ b/test/ruby/test_refinement.rb @@ -1824,13 +1824,7 @@ class TestRefinement < Test::Unit::TestCase end }.refinements assert_equal(Integer, refinements[0].target) - assert_warn(/Refinement#refined_class is deprecated and will be removed in Ruby 3.4; use Refinement#target instead/) do - assert_equal(Integer, refinements[0].refined_class) - end assert_equal(String, refinements[1].target) - assert_warn(/Refinement#refined_class is deprecated and will be removed in Ruby 3.4; use Refinement#target instead/) do - assert_equal(String, refinements[1].refined_class) - end end def test_warn_setconst_in_refinmenet