Project

General

Profile

ActionsLike0

Feature #13083

closed

Regexp#{match,match?} with a nil argument are deprecated and will raise a TypeError in Ruby 3.0

Added by kachick (Kenichi Kamiya) over 8 years ago. Updated over 5 years ago.

Status:
Closed
Assignee:
-
Target version:
[ruby-core:78891]

Description

Just for consistency

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

'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

'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

Added by Eregon (Benoit Daloze) over 5 years ago

Revision 4fe89e08

Add entry for Feature #13083 in NEWS

  • Move Unicode changes under String / Unicode for consistency with the rest.

Added by Eregon (Benoit Daloze) over 5 years ago

Revision fbacfe68

Update NEWS entry for Feature #13083

Added by naruse (Yui NARUSE) over 5 years ago

Revision 8852fa87

Revert "Regexp#match{?} with nil raises TypeError as String, Symbol (#1506)"

This reverts commit 2a22a6b2d8465934e75520a7fdcf522d50890caf.
Revert [Feature #13083]

Added by znz (Kazuhiro NISHIYAMA) over 5 years ago

Revision 4cc83f9a

[Feature #13083] is already reverted

ActionsLike0

Also available in: Atom PDF