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.4 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, T_SPF_PERMERROR,UNPARSEABLE_RELAY,URIBL_GREY shortcircuit=no autolearn=no 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 BB4DD1F54E for ; Wed, 3 Aug 2022 06:13:00 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sendgrid.me header.i=@sendgrid.me header.b="bftQQgeb"; dkim-atps=neutral Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 9500B12133D; Wed, 3 Aug 2022 15:12:53 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 925FC1214AD for ; Wed, 3 Aug 2022 15:12:51 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sendgrid.me; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc; s=smtpapi; bh=WwpFyKHpek0a5bIj5krTFGqzr0xV8Drg1KUjDNkf5IM=; b=bftQQgeb1rpa8zT3snbg6M1TJVNoYRscwed/aS1t4Jdyyr9h1oLDkD0Boc8Aq3yAVAd1 46EduW4Wi2+l9oQKHV508j33oYYInFSGLc+9i/HwkGddOFoDDl9KINVS+Lqg4k3/l7gKL4 b3LPAfugJ3jxX0Fi55cH162mOuQPJGEq8= Received: by filterdrecv-68b46c5bd4-qcncw with SMTP id filterdrecv-68b46c5bd4-qcncw-1-62EA11E1-14 2022-08-03 06:12:49.362338463 +0000 UTC m=+1073199.465117255 Received: from herokuapp.com (unknown) by geopod-ismtpd-4-5 (SG) with ESMTP id PUOWOlTARMSjFwOgtXe0fQ for ; Wed, 03 Aug 2022 06:12:49.251 +0000 (UTC) Date: Wed, 03 Aug 2022 06:12:49 +0000 (UTC) From: "nobu (Nobuyoshi Nakada)" Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 18953 X-Redmine-Issue-Author: ttanimichi X-Redmine-Sender: nobu 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-Redmine-MailingListIntegration-Message-Ids: 85827 X-SG-EID: =?us-ascii?Q?rA5eEsXeCy+asKowYcicHxhOSUaOWYD+XnPnBc7LFC8Re9tNQ4Sv5BA=2FOz+glG?= =?us-ascii?Q?+50K4steq4vSjkkyeSAt=2FQpZK6mQgZdK22n=2FlxG?= =?us-ascii?Q?4Fre1AO+Ob6r5gFyV250Paa6u1VwfZ3+CLxjOTm?= =?us-ascii?Q?HoOWf2Q0hQi9RnqlgnZfDtk4aI2db02D3sZVcdf?= =?us-ascii?Q?8Lj5fhIAgmnkePLalAlSI3PWQPXgfmr904EgUu1?= =?us-ascii?Q?DNfR0CY=2F1GVPy3=2FhzxFfvd5xwudbcDaKQQhEdQG?= =?us-ascii?Q?lrFujdVJDWS4q1rpu+Guw=3D=3D?= To: ruby-dev@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-dev X-Mail-Count: 51191 Subject: [ruby-dev:51191] [Ruby master Bug#18953] `Array#uniq` doesn't evaluate the given block when the size of the array is one X-BeenThere: ruby-dev@ruby-lang.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Ruby developers \(Japanese\)" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Reply-To: "Ruby developers \(Japanese\)" Errors-To: ruby-dev-bounces@ruby-lang.org Sender: "ruby-dev" Issue #18953 has been updated by nobu (Nobuyoshi Nakada). I think this is an expected behavior, but an implementation detail. ---------------------------------------- Bug #18953: `Array#uniq` doesn't evaluate the given block when the size of the array is one https://bugs.ruby-lang.org/issues/18953#change-98571 * Author: ttanimichi (Tsukuru Tanimichi) * Status: Open * Priority: Normal * ruby -v: ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- `Array#uniq` doesn't evaluate the given block when the size of the array is one. Is this expected behavior? ``` $ ruby -e '[42, 43].uniq { _1.foo }; puts true' -e:1:in `block in
': undefined method `foo' for 42:Integer (NoMethodError) [42, 43].uniq { _1.foo }; puts true ^^^^ Did you mean? floor from -e:1:in `uniq' from -e:1:in `
' ``` ``` $ ruby -e '[42].uniq { _1.foo }; puts true' true ``` -- https://bugs.ruby-lang.org/