From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 8331A1F454 for ; Mon, 4 Nov 2019 13:51:51 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id B8A4E1209D1; Mon, 4 Nov 2019 22:51:41 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id A3E691209CA for ; Mon, 4 Nov 2019 22:51:39 +0900 (JST) Received: by filter0091p3las1.sendgrid.net with SMTP id filter0091p3las1-1745-5DC02CEE-8 2019-11-04 13:51:42.142394517 +0000 UTC m=+311869.837920812 Received: from herokuapp.com (unknown [3.88.230.70]) by ismtpd0087p1mdw1.sendgrid.net (SG) with ESMTP id K5rc5jCdSGOCVv2jUmGNRQ for ; Mon, 04 Nov 2019 13:51:42.067 +0000 (UTC) Date: Mon, 04 Nov 2019 13:51:42 +0000 (UTC) From: daniel@dan42.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 71258 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 13083 X-Redmine-Issue-Author: kachick X-Redmine-Sender: Dan0042 X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?8sy4RigFvRTdBfCVJrT9zb2J88PC92TMQwdNgaWYaq5Qafq5Gwr3h=2FIxvdTEn8?= =?us-ascii?Q?PvX6IdYOj7JcxXcLivG57=2FtEiDGcDqehXE7uRYK?= =?us-ascii?Q?y7O9sdRa7=2FmtO4F3tVKtJnEd7qnzYa80AtA3UQd?= =?us-ascii?Q?f0j0BOJgS8PHVnwiNunPdsWHPBhq=2FR4Eob8pVzu?= =?us-ascii?Q?AbMt8Cr9mz46l?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95666 Subject: [ruby-core:95666] [Ruby master Feature#13083] Regexp#{match, match?} with a nil argument are deprecated and will raise a TypeError in Ruby 3.0 X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #13083 has been updated by Dan0042 (Daniel DeLorme). Is there a benefit to the change apart from consistency? A concrete benefit I mean. ---------------------------------------- Feature #13083: Regexp#{match,match?} with a nil argument are deprecated and will raise a TypeError in Ruby 3.0 https://bugs.ruby-lang.org/issues/13083#change-82452 * 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/