From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (smtp.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id EBC5519E0036 for ; Tue, 22 Dec 2015 19:27:20 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 10E12B5D847 for ; Tue, 22 Dec 2015 19:59:39 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 9A32618CC7B8 for ; Tue, 22 Dec 2015 19:59:39 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 89DE8120571; Tue, 22 Dec 2015 19:59:36 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o2.heroku.sendgrid.net (o2.heroku.sendgrid.net [67.228.50.55]) by neon.ruby-lang.org (Postfix) with ESMTPS id 51DC61204B0 for ; Tue, 22 Dec 2015 19:59:32 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=WPK6xPZDg7Clx+Iwya4BV/vzNbs=; b=i17vwMhx2nT8aop6BU kNObCBusXYoJH+1Bq7UnQ1U/jhVU9tlOi7hUpIYg98eQbw3UWc7Zh2/v8uR5bTzR tgsVRZS8aOg4qlHZEXzk39G3XU7IChMsUpbltWgao1fFurj3yLS2+DqCRr1a5hdG w+pYosWNg5+j554LraDjTNi4o= Received: by filter0872p1mdw1.sendgrid.net with SMTP id filter0872p1mdw1.4946.56792D093C 2015-12-22 10:59:21.78979717 +0000 UTC Received: from herokuapp.com (ec2-54-166-57-10.compute-1.amazonaws.com [54.166.57.10]) by ismtpd0006p1iad1.sendgrid.net (SG) with ESMTP id D6IVjruyRYuwSh2uMERLgA for ; Tue, 22 Dec 2015 10:59:21.659 +0000 (UTC) Date: Tue, 22 Dec 2015 10:59:21 +0000 From: sawadatsuyoshi@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Redmine-MailingListIntegration-Message-Ids: 47035 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11860 X-Redmine-Issue-Author: sawa X-Redmine-Sender: sawa 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: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS5lYzCYJGMTXWYXqnHGc7CvZsIJhaXrEkwATU LdcXQdWTWsqqMocklIcjbUmmLv4tGu+ZXRIVYHRFOYe74OXK6blmTuY5Lf1q1uRLvsvw9QqImAawUN 6YloWbsm1cJDxh/KJDlNnpMgykdrMPMNHPIqmIdfVOvJP0uuvju+mESLIw== X-ML-Name: ruby-core X-Mail-Count: 72431 Subject: [ruby-core:72431] [Ruby trunk - Bug #11860] Double splat does not work on empty hash assigned via variable 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: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #11860 has been updated by Tsuyoshi Sawada. I found more cases (other than via variable) that the double splat does not work on an empty hash. While parenthesis does not cause the issue: [**({})] # => [] expressions more complicated than that seem to cause the issue: [**({} if true)] # => [{}] [**(if true; {} end)] # => [{}] [**(false ? :foo : {})] # => [{}] ---------------------------------------- Bug #11860: Double splat does not work on empty hash assigned via variable https://bugs.ruby-lang.org/issues/11860#change-55725 * Author: Tsuyoshi Sawada * Status: Open * Priority: Normal * Assignee: * ruby -v: 2.3.0preview2 (2015-12-11 trunk 53028) [x86_64-linux] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- When an empty hash is given as a literal, the double splat operates on it, and leaves nothing, which is expected. class String def foo; end end [**{}] # => [] "foo".foo(**{}) # => nil "foo".send(**{}) # => nil However, when an empty hash is given via variable, the double splat retains an empty hash in place. h = {} [**h] # => [{}] "foo".foo(**h) # => wrong number of arguments (given 1, expected 0) "foo".send(**h) # => wrong number of arguments (given 1, expected 0) -- https://bugs.ruby-lang.org/