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.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham 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 097671F4C0 for ; Thu, 17 Oct 2019 22:05:18 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id D5FDB120AE5; Fri, 18 Oct 2019 07:05:07 +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 7907C12098A for ; Fri, 18 Oct 2019 07:05:05 +0900 (JST) Received: by filter0064p3iad2.sendgrid.net with SMTP id filter0064p3iad2-15985-5DA8E593-151 2019-10-17 22:05:07.981168646 +0000 UTC m=+611423.581269063 Received: from herokuapp.com (unknown [54.167.110.97]) by ismtpd0033p1mdw1.sendgrid.net (SG) with ESMTP id htVf8tm4QiqQxaCT37sU0w for ; Thu, 17 Oct 2019 22:05:07.911 +0000 (UTC) Date: Thu, 17 Oct 2019 22:05:08 +0000 (UTC) From: merch-redmine@jeremyevans.net Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 70994 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15052 X-Redmine-Issue-Author: mame X-Redmine-Sender: jeremyevans0 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: =?us-ascii?Q?RVE3t853K5scBhbmJHUzZTFFeVC=2FZSUmHZ0Dc+26wcEi2CTgsF1oz0wTSSxGGN?= =?us-ascii?Q?BIkqf1UWWrec35xMddlNoXxJW2tAgS=2FZOn85M5X?= =?us-ascii?Q?It2rHT4zRJLeCikgVUYejDBOx3ygLmq+jL8LoNZ?= =?us-ascii?Q?fYF2O14YE+O=2FEnRT4PsSo+dMCXQQoTle58JKKjI?= =?us-ascii?Q?h=2FQ7qw8DJ61MrIYdeZWhOHtAvpZ0csTe6Tg=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95405 Subject: [ruby-core:95405] [Ruby master 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 updated by jeremyevans0 (Jeremy Evans). Status changed from Open to Closed Fixed by commit:1d5066efb08cbb328ba528a5f8be1708584b659f. ---------------------------------------- Bug #15052: must not optimize `foo(**{})` out https://bugs.ruby-lang.org/issues/15052#change-82136 * Author: mame (Yusuke Endoh) * Status: Closed * 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/