From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,SPF_PASS, T_DKIM_INVALID shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 8F75A202A0 for ; Wed, 1 Nov 2017 17:02:42 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id DEB691209C4; Thu, 2 Nov 2017 02:02:39 +0900 (JST) Received: from o1678916x28.outbound-mail.sendgrid.net (o1678916x28.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id E5E4F120978 for ; Thu, 2 Nov 2017 02:02:37 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=hB8K1/FKXcueu0N09Zn0YF83C2U=; b=ZTovh43zZ9oXDujKgT kwKdaayHYEgzzEPzsgvSuR2ZToH//Pw380EK967T6buCFRXIYd/6OygF1LsR+/Zg tGVTrs71zRJED9y87hYH9wzUx3qPZKl/xMRjJqxafO5oUvgOaw30qKOk+sQQdzcr U8hw40pd5UYUiEKivdiTMi+II= Received: by filter0001p3iad2.sendgrid.net with SMTP id filter0001p3iad2-16194-59F9FE29-A 2017-11-01 17:02:33.569409729 +0000 UTC Received: from herokuapp.com (ec2-54-163-139-143.compute-1.amazonaws.com [54.163.139.143]) by ismtpd0016p1iad2.sendgrid.net (SG) with ESMTP id T-Rs0YTrQMGK8CsCvPK9wA Wed, 01 Nov 2017 17:02:33.609 +0000 (UTC) Date: Wed, 01 Nov 2017 17:02:34 +0000 (UTC) From: ruby-core@marc-andre.ca To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 58757 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 10856 X-Redmine-Issue-Author: seantheprogrammer X-Redmine-Issue-Assignee: nobu X-Redmine-Sender: marcandre 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS7Fr/9jcao0tJjW29FcrwVUiiLtGZQsmhhY7S 7CAkY+XmxyRlTab+8LDhio/AVK7cZB6noQVtzLAEiUBplsCx4zN79PT0Z5H6Qwc1zwkOAxjlxhUOYm Z0wB0uhOf7p2TBQnYJ2FqsZXkTN85bdFfKSkRyIXFx0uNmV+7V67oSNyJw== X-ML-Name: ruby-core X-Mail-Count: 83638 Subject: [ruby-core:83638] [Ruby trunk Bug#10856][Open] Splat with empty keyword args gives unexpected results 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 #10856 has been updated by marcandre (Marc-Andre Lafortune). Status changed from Closed to Open Assignee set to nobu (Nobuyoshi Nakada) Target version set to 2.5 This is not actually fixed. ``` def foo puts "OK" end options = {} foo(**options) # => OK (In 2.5.0preview1) args = [] foo(*args, **options) # => ArgumentError: wrong number of arguments (given 1, expected 0) ``` The second call should also output "Ok". Hopefully Nobu can crack this before 2.5.0 ---------------------------------------- Bug #10856: Splat with empty keyword args gives unexpected results https://bugs.ruby-lang.org/issues/10856#change-67666 * Author: seantheprogrammer (Sean Griffin) * Status: Open * Priority: Normal * Assignee: nobu (Nobuyoshi Nakada) * Target version: 2.5 * ruby -v: ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin13] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- When keyword args are passed to a method with splat, and there are no keyword args, an empty hash is sent. I would expect no argument to be given, same as splat with an empty array. For example: ```ruby def foo end foo(**{}) ``` This causes an argument error, as an empty hash is passed. I would expect the same behavior as ```ruby def foo end foo(*[]) ``` -- https://bugs.ruby-lang.org/