diff --git a/core/integer.rbs b/core/integer.rbs index fd2ef0ae4..cc84c8201 100644 --- a/core/integer.rbs +++ b/core/integer.rbs @@ -93,6 +93,8 @@ # given value. # class Integer < Numeric + # TODO: `undef self.new` + # # Returns `true` if `self` is numerically equal to `other`; `false` otherwise. @@ -421,7 +414,7 @@ class Integer < Numeric # # Related: Integer#eql? (requires `other` to be an Integer). # - def ==: (untyped) -> bool + def ==: (untyped other) -> bool # # Returns `1`. # - def denominator: () -> Integer + def denominator: () -> 1 # # Returns a string containing the place-value representation of `self` in radix @@ -964,14 +978,14 @@ class Integer < Numeric # 3.lcm(-7) #=> 21 # ((1<<31)-1).lcm((1<<61)-1) #=> 4951760154835678088235319297 # - def lcm: (Integer) -> Integer + def lcm: (Integer other_int) -> Integer # # - def magnitude: () -> Integer + alias magnitude abs # # Returns `self` modulo `other` as a real numeric (Integer, Float, or Rational). @@ -1009,7 +1023,7 @@ class Integer < Numeric # # Related: Integer#pred (predecessor value). # - def next: () -> Integer + alias next succ # # Returns `self`. # - def numerator: () -> Integer + def numerator: () -> self # # Returns `self`; intended for compatibility to character literals in Ruby 1.9. # - def ord: () -> Integer + def ord: () -> self def polar: () -> [ Integer, Integer | Float ] @@ -1072,11 +1086,8 @@ class Integer < Numeric # a.pow(b) #=> same as a**b # a.pow(b, m) #=> same as (a**b) % m, but avoids huge temporary values # - def pow: (Integer other) -> (Integer | Rational) - | (Integer other, Integer modulo) -> Integer - | (Float) -> (Float | Complex) - | (Rational) -> (Float | Rational | Complex) - | (Complex) -> Complex + def pow: (Integer other, ?Integer m) -> Integer + | [S, R] (Numeric::_Coerce[self, RBS::Ops::_Power[S, R], S] other) -> R # # Returns `self` (which is already an Integer). # - def to_i: () -> Integer + def to_i: () -> self #