From: zn@... Date: 2019-10-21T03:41:46+00:00 Subject: [ruby-core:95448] [Ruby master Feature#13083] {String|Symbol}#match{?} with nil returns falsy as Regexp#match{?} Issue #13083 has been updated by znz (Kazuhiro NISHIYAMA). I heard this change breaks activerecord. https://twitter.com/shyouhei/status/1186122901667209216 https://twitter.com/shyouhei/status/1186123025604734976 https://github.com/rails/rails/blob/01336b71af6ac798e48101b4ceb2de00397243aa/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb#L52 ---------------------------------------- Feature #13083: {String|Symbol}#match{?} with nil returns falsy as Regexp#match{?} https://bugs.ruby-lang.org/issues/13083#change-82199 * 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/ Unsubscribe: