Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept Numeric by Integer#{upto,downto} #914

Merged
merged 1 commit into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions core/integer.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -857,8 +857,8 @@ class Integer < Numeric
#
# With no block given, returns an Enumerator.
#
def downto: (Integer limit) { (Integer) -> void } -> Integer
| (Integer limit) -> ::Enumerator[Integer, self]
def downto: (Numeric limit) { (Integer) -> void } -> Integer
| (Numeric limit) -> ::Enumerator[Integer, self]

def dup: () -> self

Expand Down Expand Up @@ -1432,8 +1432,8 @@ class Integer < Numeric
#
# With no block given, returns an Enumerator.
#
def upto: (Integer limit) { (Integer) -> void } -> Integer
| (Integer limit) -> ::Enumerator[Integer, self]
def upto: (Numeric limit) { (Integer) -> void } -> Integer
| (Numeric limit) -> ::Enumerator[Integer, self]

# <!--
# rdoc-file=numeric.rb
Expand Down
2 changes: 2 additions & 0 deletions test/stdlib/Integer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ def test_div_mod
def test_down_to
30.downto(1) {}
30.downto(31)
30.downto(4.2)
end

def test_eql?
Expand Down Expand Up @@ -338,6 +339,7 @@ def test_truncate

def test_upto
5.upto(10) {}
5.upto(10.1) {}
end
end

Expand Down