Remove obsolete Fixnum and Bignum

This commit is contained in:
Nobuyoshi Nakada 2020-12-28 11:58:21 +09:00
parent b948b1a4e1
commit 40e7aefeba
Notes: git 2021-12-28 18:35:22 +09:00
4 changed files with 20 additions and 26 deletions

View file

@ -7169,10 +7169,6 @@ rb_int_powm(int const argc, VALUE * const argv, VALUE const num)
void void
Init_Bignum(void) Init_Bignum(void)
{ {
/* An obsolete class, use Integer */
rb_define_const(rb_cObject, "Bignum", rb_cInteger);
rb_deprecate_constant(rb_cObject, "Bignum");
rb_define_method(rb_cInteger, "coerce", rb_int_coerce, 1); rb_define_method(rb_cInteger, "coerce", rb_int_coerce, 1);
#ifdef USE_GMP #ifdef USE_GMP

View file

@ -6290,10 +6290,6 @@ Init_Numeric(void)
rb_gc_register_mark_object(rb_fix_to_s_static[i]); rb_gc_register_mark_object(rb_fix_to_s_static[i]);
} }
/* An obsolete class, use Integer */
rb_define_const(rb_cObject, "Fixnum", rb_cInteger);
rb_deprecate_constant(rb_cObject, "Fixnum");
rb_cFloat = rb_define_class("Float", rb_cNumeric); rb_cFloat = rb_define_class("Float", rb_cNumeric);
rb_undef_alloc_func(rb_cFloat); rb_undef_alloc_func(rb_cFloat);

View file

@ -54,8 +54,8 @@ while 0x00012345 >= $counter
srand +big && $counter >> 0b1 srand +big && $counter >> 0b1
Enumerable Enumerable
Fixnum String
Bignum Struct
Math Math
Complex Complex
Comparable Comparable

View file

@ -1,25 +1,27 @@
require_relative '../../spec_helper' require_relative '../../spec_helper'
describe "Fixnum" do ruby_version_is ""..."3.1" do
it "is unified into Integer" do describe "Fixnum" do
suppress_warning do it "is unified into Integer" do
Fixnum.should equal(Integer) suppress_warning do
Fixnum.should equal(Integer)
end
end
it "is deprecated" do
-> { Fixnum }.should complain(/constant ::Fixnum is deprecated/)
end end
end end
it "is deprecated" do describe "Bignum" do
-> { Fixnum }.should complain(/constant ::Fixnum is deprecated/) it "is unified into Integer" do
end suppress_warning do
end Bignum.should equal(Integer)
end
end
describe "Bignum" do it "is deprecated" do
it "is unified into Integer" do -> { Bignum }.should complain(/constant ::Bignum is deprecated/)
suppress_warning do
Bignum.should equal(Integer)
end end
end end
it "is deprecated" do
-> { Bignum }.should complain(/constant ::Bignum is deprecated/)
end
end end