Remove deprecated method Refinement#refined_class

[Feature #20901]
This commit is contained in:
Shugo Maeda 2024-11-19 13:41:39 +09:00 committed by Shugo Maeda
parent 9c777f282f
commit 7ed027a833
Notes: git 2024-11-19 05:33:57 +00:00
3 changed files with 4 additions and 22 deletions

View File

@ -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] #=> [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 * RubyVM::AbstractSyntaxTree
* Add RubyVM::AbstractSyntaxTree::Node#locations method which returns location objects * Add RubyVM::AbstractSyntaxTree::Node#locations method which returns location objects

16
eval.c
View File

@ -1403,21 +1403,6 @@ rb_refinement_module_get_refined_class(VALUE module)
return rb_attr_get(module, id_refined_class); 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 static void
add_activated_refinement(VALUE activated_refinements, add_activated_refinement(VALUE activated_refinements,
VALUE klass, VALUE refinement) VALUE klass, VALUE refinement)
@ -2131,7 +2116,6 @@ Init_eval(void)
rb_undef_method(rb_cClass, "refine"); rb_undef_method(rb_cClass, "refine");
rb_define_private_method(rb_cRefinement, "import_methods", refinement_import_methods, -1); 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, "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, "append_features");
rb_undef_method(rb_cRefinement, "prepend_features"); rb_undef_method(rb_cRefinement, "prepend_features");
rb_undef_method(rb_cRefinement, "extend_object"); rb_undef_method(rb_cRefinement, "extend_object");

View File

@ -1824,13 +1824,7 @@ class TestRefinement < Test::Unit::TestCase
end end
}.refinements }.refinements
assert_equal(Integer, refinements[0].target) 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_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 end
def test_warn_setconst_in_refinmenet def test_warn_setconst_in_refinmenet