ruby-changes:70634
From: Nobuyoshi <ko1@a...>
Date: Tue, 28 Dec 2021 18:35:15 +0900 (JST)
Subject: [ruby-changes:70634] 40e7aefeba (master): Remove obsolete Fixnum and Bignum
https://git.ruby-lang.org/ruby.git/commit/?id=40e7aefeba From 40e7aefebad412bde50fa9bdadcc8405f7605355 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Mon, 28 Dec 2020 11:58:21 +0900 Subject: Remove obsolete Fixnum and Bignum --- bignum.c | 4 ---- numeric.c | 4 ---- sample/trick2015/kinaba/entry.rb | 4 ++-- spec/ruby/core/integer/constants_spec.rb | 32 +++++++++++++++++--------------- 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/bignum.c b/bignum.c index f83fbe2c14b..841ed78665c 100644 --- a/bignum.c +++ b/bignum.c @@ -7169,10 +7169,6 @@ rb_int_powm(int const argc, VALUE * const argv, VALUE const num) https://github.com/ruby/ruby/blob/trunk/bignum.c#L7169 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); #ifdef USE_GMP diff --git a/numeric.c b/numeric.c index d6fe05d8e81..1de11d12844 100644 --- a/numeric.c +++ b/numeric.c @@ -6290,10 +6290,6 @@ Init_Numeric(void) https://github.com/ruby/ruby/blob/trunk/numeric.c#L6290 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_undef_alloc_func(rb_cFloat); diff --git a/sample/trick2015/kinaba/entry.rb b/sample/trick2015/kinaba/entry.rb index aa077dc2408..2a75888ef5f 100644 --- a/sample/trick2015/kinaba/entry.rb +++ b/sample/trick2015/kinaba/entry.rb @@ -54,8 +54,8 @@ while 0x00012345 >= $counter https://github.com/ruby/ruby/blob/trunk/sample/trick2015/kinaba/entry.rb#L54 srand +big && $counter >> 0b1 Enumerable - Fixnum - Bignum + String + Struct Math Complex Comparable diff --git a/spec/ruby/core/integer/constants_spec.rb b/spec/ruby/core/integer/constants_spec.rb index 3b8b01e330b..2aaa659d5ab 100644 --- a/spec/ruby/core/integer/constants_spec.rb +++ b/spec/ruby/core/integer/constants_spec.rb @@ -1,25 +1,27 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/integer/constants_spec.rb#L1 require_relative '../../spec_helper' -describe "Fixnum" do - it "is unified into Integer" do - suppress_warning do - Fixnum.should equal(Integer) +ruby_version_is ""..."3.1" do + describe "Fixnum" do + it "is unified into Integer" do + suppress_warning do + Fixnum.should equal(Integer) + end end - end - it "is deprecated" do - -> { Fixnum }.should complain(/constant ::Fixnum is deprecated/) + it "is deprecated" do + -> { Fixnum }.should complain(/constant ::Fixnum is deprecated/) + end end -end -describe "Bignum" do - it "is unified into Integer" do - suppress_warning do - Bignum.should equal(Integer) + describe "Bignum" do + it "is unified into Integer" do + suppress_warning do + Bignum.should equal(Integer) + end end - end - it "is deprecated" do - -> { Bignum }.should complain(/constant ::Bignum is deprecated/) + it "is deprecated" do + -> { Bignum }.should complain(/constant ::Bignum is deprecated/) + end end end -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/