From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.1 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 9D0CC1F404 for ; Fri, 31 Aug 2018 12:09:52 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id A6136120B1D; Fri, 31 Aug 2018 21:09:49 +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 8F193120B1C for ; Fri, 31 Aug 2018 21:09:46 +0900 (JST) Received: by filter0088p3las1.sendgrid.net with SMTP id filter0088p3las1-23578-5B893006-12 2018-08-31 12:09:42.428709266 +0000 UTC m=+45411.854110534 Received: from herokuapp.com (ec2-54-196-118-249.compute-1.amazonaws.com [54.196.118.249]) by ismtpd0019p1iad2.sendgrid.net (SG) with ESMTP id n8YRYzBBSEKqLxLJDiwHIg for ; Fri, 31 Aug 2018 12:09:42.317 +0000 (UTC) Date: Fri, 31 Aug 2018 12:09:43 +0000 (UTC) From: mame@ruby-lang.org To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 64164 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15052 X-Redmine-Issue-Author: mame X-Redmine-Sender: mame 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS6y6ISUfiAAOFXaCe4uBm12QX1ctlj2pX/rqz x3F3OoC5iqeLpO0xaI55fu/O3kULOF5jj/q6vg455zBotelIMXt6JJpwv4JFWS8h1xsDClkNBZhbZt w96AjRKIiUhRG8MO/vqtIlXv2/NGQGrZ+j/j8UJT+W7NZMOeV1rtIe/2tg== X-ML-Name: ruby-core X-Mail-Count: 88785 Subject: [ruby-core:88785] [Ruby trunk Bug#15052] must not optimize `foo(**{})` out 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 #15052 has been reported by mame (Yusuke Endoh). ---------------------------------------- Bug #15052: must not optimize `foo(**{})` out https://bugs.ruby-lang.org/issues/15052 * Author: mame (Yusuke Endoh) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- A keyword rest argument with empty hash, `**{}`, is removed during parsing phase. However, under the current spec of keyword parameters, this leads to a problem: ``` def foo(opt = "opt", **hsh) p [opt, hsh] end foo({}, **{}) #=> expected: [{}, {}], actual: ["opt", {}] ``` `foo({}, **{})` is obviously expected to pass the first `{}` to `opt`, and the second `**{}` to `**hsh`. However, `**{}` is removed at parsing phase, sp the first `{}` is considered as a keyword rest argument, which causes the above strange result. So, we cannot optimize `**{}` out, unless keyword argument is separated from normal arguments #14183. (The current spec is really intractable not only for Ruby users but also for Ruby developers!) ---Files-------------------------------- do-not-optimize-keyword-argument-with-empty-hash.patch (717 Bytes) -- https://bugs.ruby-lang.org/