mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[Feature #12005] Unify Fixnum and Bignum into Integer
* [Feature #12005] Unify Fixnum and Bignum into Integer * include/ruby/ruby.h (rb_class_of): Return rb_cInteger for fixnums. * insns.def (INTEGER_REDEFINED_OP_FLAG): Unified from FIXNUM_REDEFINED_OP_FLAG and BIGNUM_REDEFINED_OP_FLAG. * vm_core.h: Ditto. * vm_insnhelper.c (opt_eq_func): Use INTEGER_REDEFINED_OP_FLAG instead of FIXNUM_REDEFINED_OP_FLAG. * vm.c (vm_redefinition_check_flag): Use rb_cInteger instead of rb_cFixnum and rb_cBignum. (C): Use Integer instead of Fixnum and Bignum. * numeric.c (fix_succ): Removed. (Init_Numeric): Define Fixnum as Integer. * bignum.c (bignew): Use rb_cInteger instead of Rb_cBignum. (rb_int_coerce): replaced from rb_big_coerce and return fixnums as-is. (Init_Bignum): Define Bignum as Integer. Don't define ===. * error.c (builtin_class_name): Return "Integer" for fixnums. * sprintf.c (ruby__sfvextra): Use rb_cInteger instead of rb_cFixnum. * ext/-test-/testutil: New directory to test. Currently it provides utilities for fixnum and bignum. * ext/json/generator/generator.c: Define mInteger_to_json. * lib/mathn.rb (Fixnum#/): Redefinition removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
565241f11f
commit
f9727c12cc
25 changed files with 159 additions and 146 deletions
|
@ -15,17 +15,17 @@ assert_equal 'sym', ':sym'
|
|||
assert_equal ':sym', ':sym.inspect'
|
||||
assert_equal 'Symbol', ':sym.class'
|
||||
assert_equal '1234', '1234'
|
||||
assert_equal 'Fixnum', '1234.class'
|
||||
assert_equal 'Integer', '1234.class'
|
||||
assert_equal '1234', '1_2_3_4'
|
||||
assert_equal 'Fixnum', '1_2_3_4.class'
|
||||
assert_equal 'Integer', '1_2_3_4.class'
|
||||
assert_equal '18', '0x12'
|
||||
assert_equal 'Fixnum', '0x12.class'
|
||||
assert_equal 'Integer', '0x12.class'
|
||||
assert_equal '15', '0o17'
|
||||
assert_equal 'Fixnum', '0o17.class'
|
||||
assert_equal 'Integer', '0o17.class'
|
||||
assert_equal '5', '0b101'
|
||||
assert_equal 'Fixnum', '0b101.class'
|
||||
assert_equal 'Integer', '0b101.class'
|
||||
assert_equal '123456789012345678901234567890', '123456789012345678901234567890'
|
||||
assert_equal 'Bignum', '123456789012345678901234567890.class'
|
||||
assert_equal 'Integer', '123456789012345678901234567890.class'
|
||||
assert_equal '2.0', '2.0'
|
||||
assert_equal 'Float', '1.3.class'
|
||||
|
||||
|
@ -169,7 +169,7 @@ assert_equal 'a', 'r = ("a".."c"); r.begin'
|
|||
assert_equal 'c', 'r = ("a".."c"); r.end'
|
||||
|
||||
assert_equal 'String', '__FILE__.class'
|
||||
assert_equal 'Fixnum', '__LINE__.class'
|
||||
assert_equal 'Integer', '__LINE__.class'
|
||||
|
||||
###
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue