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 768CB1F54E for ; Tue, 2 Aug 2022 02:15:57 +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="eDI0Vrv8"; dkim-atps=neutral Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 19AA1120D15; Tue, 2 Aug 2022 11:15:55 +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 168CF120D07 for ; Tue, 2 Aug 2022 11:15:49 +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=7umH5/bxexqJKfaiG+UvUq6PfqGfO2h3RdmRU6f3zO4=; b=eDI0Vrv8opEWtgUTaQwcDJuujV2N7cJid8JESts9L1napQbyATqid97apoJnrRo+ZXwt 6mlHx+zFUxJrrlWarV96P/OU7Z/ZMb8JITQd7Rd99VMmRZxy9QG5u1dYrhm9roMEuzYEZl 78222/WCbToNwrBlaRpklN1rSA9ynKUxE= Received: by filterdrecv-66b95c5ffd-54pvm with SMTP id filterdrecv-66b95c5ffd-54pvm-1-62E888D4-37 2022-08-02 02:15:48.359005023 +0000 UTC m=+467108.515722890 Received: from herokuapp.com (unknown) by geopod-ismtpd-2-1 (SG) with ESMTP id FVGk3YzZS7CR9ueE125K9Q for ; Tue, 02 Aug 2022 02:15:48.312 +0000 (UTC) Date: Tue, 02 Aug 2022 02:15:48 +0000 (UTC) From: "ttanimichi (Tsukuru Tanimichi)" 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: ttanimichi 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: 85812 X-SG-EID: =?us-ascii?Q?MV+=2FJIkR1R+g39pXOHDBdqPrsNnWDNzY0X2Qq4a1ZdCQ7+WXKgi+DYEOWt+rkg?= =?us-ascii?Q?iK2xSEgJ2qV5TnF90uRPipT2XwVZnJLDRFbpC2u?= =?us-ascii?Q?mARUD=2FajTHi0Jqu2oNzPXpNdFlwM1Z5zBGBoeMY?= =?us-ascii?Q?anAbwAKEIAYmF1gs88rv2VjzttAyfckq4X+OdyS?= =?us-ascii?Q?wqQsEDv8CzgXl7EisJBvE6VNWtFjxZ=2F2QefG5Mc?= =?us-ascii?Q?11z5GYXhlde4doKdwZCyErIggwUhLumrK9cFu8I?= =?us-ascii?Q?jd8iYj5yEXXrxLl5PsY4g=3D=3D?= To: ruby-dev@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-dev X-Mail-Count: 51189 Subject: [ruby-dev:51189] [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 reported by ttanimichi (Tsukuru Tanimichi). ---------------------------------------- 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 * 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/