Skip to content

Commit 06f87f2

Browse files
committed
Fix #divmod methods
1 parent 2a6c00b commit 06f87f2

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

core/float.rbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,8 @@ class Float < Numeric
442442
# 13.0.divmod(4.0) # => [3, 1.0]
443443
# 13.0.divmod(Rational(4, 1)) # => [3, 1.0]
444444
#
445-
def divmod: (Numeric) -> [ Numeric, Numeric ]
445+
def divmod: (Integer | Float | Rational) -> [ Integer, Float ]
446+
| (Numeric) -> [ Numeric, Numeric ]
446447

447448
def dup: () -> self
448449

core/integer.rbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,8 @@ class Integer < Numeric
766766
# 13.divmod(Rational(4, 1)) # => [3, (1/1)]
767767
#
768768
def divmod: (Integer) -> [ Integer, Integer ]
769-
| (Float) -> [ Float, Float ]
769+
| (Float) -> [ Integer, Float ]
770+
| (Rational) -> [ Integer, Rational ]
770771
| (Numeric) -> [ Numeric, Numeric ]
771772

772773
# <!--

core/rational.rbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ class Rational < Numeric
245245

246246
def div: (Numeric) -> Integer
247247

248-
def divmod: (Numeric) -> [ Numeric, Numeric ]
248+
def divmod: (Integer | Float | Rational) -> [ Integer, Rational ]
249+
| (Numeric) -> [ Numeric, Numeric ]
249250

250251
def dup: () -> self
251252

0 commit comments

Comments
 (0)