From: "thiagofm (Thiago Massa)" <noreply@ruby-lang.org>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:109896] [Ruby master Bug#18983] Range#size for beginless Range is not nil.
Date: Wed, 14 Sep 2022 22:18:02 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-99139.20220914221802.52465@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-18983.20220829141011.52465@ruby-lang.org
Issue #18983 has been updated by thiagofm (Thiago Massa).
Nevermind. Build failed.
----------------------------------------
Bug #18983: Range#size for beginless Range is not nil.
https://bugs.ruby-lang.org/issues/18983#change-99139
* Author: masasakano (Masa Sakano)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin20]
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
`Range#size` should, according to [Official docs](https://ruby-doc.org/core-3.1.2/Range.html#method-i-size),
> Returns the count of elements in self if both begin and end values are numeric; otherwise, returns nil
but it doesn't with beginless non-Numeric Ranges (in Ruby-3.1.2 or earlier).
```ruby
(..?a).size # => Infinity
(nil..nil).size # => Infinity
```
whereas it certainly does with endless Ranges
```ruby
(?a..).size # => nil
```
---Files--------------------------------
bug-20220829-beginless_range.rb (1.24 KB)
6378.patch (1.37 KB)
--
https://bugs.ruby-lang.org/
next prev parent reply other threads:[~2022-09-14 22:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-29 14:10 [ruby-core:109770] [Ruby master Bug#18983] Range#size for beginless Range is not nil masasakano (Masa Sakano)
2022-09-14 22:01 ` [ruby-core:109895] " thiagofm (Thiago Massa)
2022-09-14 22:18 ` thiagofm (Thiago Massa) [this message]
2022-09-16 17:48 ` [ruby-core:109920] " jeremyevans0 (Jeremy Evans)
2022-10-20 4:32 ` [ruby-core:110428] " matz (Yukihiro Matsumoto)
2022-10-21 4:41 ` [ruby-core:110454] " mame (Yusuke Endoh)
2022-10-21 4:41 ` [ruby-core:110455] " mame (Yusuke Endoh)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-99139.20220914221802.52465@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).