ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: zn@mbf.nifty.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:95396] [Ruby master Feature#13083] {String|Symbol}#match{?} with nil returns falsy as Regexp#match{?}
Date: Thu, 17 Oct 2019 15:24:20 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-82109.20191017152419.818694f89bf8d3e8@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-13083.20161228183444@ruby-lang.org

Issue #13083 has been updated by znz (Kazuhiro NISHIYAMA).

Status changed from Open to Closed

Merged at commit:2a22a6b2d8465934e75520a7fdcf522d50890caf

----------------------------------------
Feature #13083: {String|Symbol}#match{?} with nil returns falsy as Regexp#match{?}
https://bugs.ruby-lang.org/issues/13083#change-82109

* Author: kachick (Kenichi Kamiya)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Just for consistency

* patch: https://github.com/ruby/ruby/pull/1506
* spec: https://github.com/ruby/spec/pull/380

Currently behaves as ( ruby --version: ruby 2.5.0dev (2016-12-28 trunk 57228) [x86_64-darwin16] )

~~~ ruby
'string'.__send__(:=~, nil) #=> nil
'string'.match(nil)         #=> TypeError: wrong argument type nil (expected Regexp)
'string'.match?(nil)        #=> TypeError: wrong argument type nil (expected Regexp)
:symbol.__send__(:=~, nil)  #=> nil
:symbol.match(nil)          #=> TypeError: wrong argument type nil (expected Regexp)
:symbol.match?(nil)         #=> TypeError: wrong argument type nil (expected Regexp)
/regex/.__send__(:=~, nil)  #=> nil
/regex/.match(nil)          #=> nil
/regex/.match?(nil)         #=> false
~~~


Expected to

~~~ruby
'string'.__send__(:=~, nil) #=> nil
'string'.match(nil)         #=> nil
'string'.match?(nil)        #=> false
:symbol.__send__(:=~, nil)  #=> nil
:symbol.match(nil)          #=> nil
:symbol.match?(nil)         #=> false
/regex/.__send__(:=~, nil)  #=> nil
/regex/.match(nil)          #=> nil
/regex/.match?(nil)         #=> false
~~~



-- 
https://bugs.ruby-lang.org/

  parent reply	other threads:[~2019-10-17 15:24 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-13083.20161228183444@ruby-lang.org>
2016-12-28 18:34 ` [ruby-core:78891] [Ruby trunk Feature#13083] {String|Symbol}#match{?} with nil returns falsy as Regexp#match{?} kachick1
2016-12-29  0:15 ` [ruby-core:78894] " nobu
2017-01-02  0:22 ` [ruby-core:78936] " snood1205
2017-02-22  7:39 ` [ruby-core:79664] " matz
2019-10-17 15:24 ` zn [this message]
2019-10-21  3:41 ` [ruby-core:95448] [Ruby master " zn
2019-10-26 20:23 ` [ruby-core:95568] " eregontp
2019-10-31 22:37 ` [ruby-core:95619] " rafael
2019-11-01  2:41 ` [ruby-core:95623] " sam.saffron
2019-11-01  2:46 ` [ruby-core:95625] " shyouhei
2019-11-01  3:44 ` [ruby-core:95628] " shugo
2019-11-01  8:51 ` [ruby-core:95632] " matz
2019-11-01 16:05 ` [ruby-core:95636] " rafael
2019-11-01 18:02 ` [ruby-core:95640] " eregontp
2019-11-01 19:20 ` [ruby-core:95642] [Ruby master Feature#13083] {String|Symbol}#match{?} with nil returns falsy as Regexp#match{?} since ruby 3.0 kachick1
2019-11-03  0:35 ` [ruby-core:95656] " shugo
2019-11-03 10:18 ` [ruby-core:95657] [Ruby master Feature#13083] Regexp#{match, match?} with a nil argument are deprecated and will raise a TypeError in Ruby 3.0 eregontp
2019-11-03 10:31 ` [ruby-core:95658] " eregontp
2019-11-04 13:51 ` [ruby-core:95666] " daniel
2019-11-05  3:30 ` [ruby-core:95685] " shugo
2019-11-05  9:23 ` [ruby-core:95691] " naruse
2019-11-07 18:32 ` [ruby-core:95747] " eregontp
2019-11-14 16:14 ` [ruby-core:95850] " shevegen
2019-11-18 13:36 ` [ruby-core:95878] " knu
2019-11-18 18:01 ` [ruby-core:95879] " eregontp
2019-12-03  8:57 ` [ruby-core:96068] " naruse
2019-12-03 13:34 ` [ruby-core:96081] " matz

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-82109.20191017152419.818694f89bf8d3e8@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).