Issue #13083 has been updated by rafaelfranca (Rafael Fran=E7a).


I know this change is to make the code consistent but this is a backward in=
compatible change and I don't think it should be applied to Ruby 2.7 withou=
t deprecation. The fact that we need to change Rails and many other gems to=
 make this work is a good indication.

I thought we were avoiding making backward incompatible changes before Ruby=
 3.0.

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

* 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 5722=
8) [x86_64-darwin16] )

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


Expected to

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



-- =

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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=3Dunsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>