From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [94.130.110.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 6BBD31F44D for ; Sun, 21 Apr 2024 08:16:16 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; secure) header.d=ml.ruby-lang.org header.i=@ml.ruby-lang.org header.a=rsa-sha256 header.s=mail header.b=VVPFCS+R; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=q2Ax+pOi; dkim-atps=neutral Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 6154184319; Sun, 21 Apr 2024 08:16:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1713687366; bh=ToCxxeulMscdZqioWY3g/1NCw8hF2xuaRY3IUyjGC0w=; h=Date:References:To:Reply-To:Subject:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Cc:From; b=VVPFCS+RCMVePJV+old5whGjnoQkmmdF4Z/R4FxrR0ZrVJ0VcEsDmT6QlJhObw3oN tefy18TXLq5+3yUcpzN+rWQADyPkR2ojFbvITxKm+xXKTwhp2BCcvx/JR4JvkgPxlg UlZ2xAAhQGZLXYSgsSRA9aSw1MN12APB+z6+Fca0= Received: from s.wrqvwxzv.outbound-mail.sendgrid.net (s.wrqvwxzv.outbound-mail.sendgrid.net [149.72.154.232]) by nue.mailmanlists.eu (Postfix) with ESMTPS id DB85E84253 for ; Sun, 21 Apr 2024 08:16:01 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=pass (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=q2Ax+pOi; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ruby-lang.org; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:from:subject:to; s=s1; bh=7JcyKcC3ud0OFI6PLm3ZCrAxutlU2iCcvPm1CpqEE2s=; b=q2Ax+pOiMTJTFtsdr9mtRUELVTn3rkfnT/D/kjCH50EVbdirWCs3XLcH+RGIaB6tjQ9I u/fKk9GRBB7/ezfoPgeFaxgbD5N9EMwAbXZDcDNirJD1ZOdPk7cgjnMEpGgN/MLb486gKI hxabhUf1ujlBjfIoPersQnQHAuHx/VOD7mMGoCeQK/AnZ/MO0IGyvrM43qqUfPN7x8O8qp 9ETJdc2YSYIUBNLvavIBVvwHPStm06jZ911aBZ8fRLz1tJJR1wWCxgCwbOSsIXUONYSUgh KV6RAcL55CxidQY/FnE6DgCXzHzT3pqnL06kzAZo7rYmMwoH1jICZpBQKpAnFx2g== Received: by recvd-bb7996b79-bqq4q with SMTP id recvd-bb7996b79-bqq4q-1-6624CB40-1 2024-04-21 08:16:00.042974005 +0000 UTC m=+728123.735852399 Received: from herokuapp.com (unknown) by geopod-ismtpd-10 (SG) with ESMTP id O9cb02bBT_CL3oFF99eFcg for ; Sun, 21 Apr 2024 08:15:59.977 +0000 (UTC) Date: Sun, 21 Apr 2024 08:16:00 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 20440 X-Redmine-Issue-Author: ozydingo X-Redmine-Issue-Priority: Normal X-Redmine-Sender: ozydingo 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: 94226 X-SG-EID: =?us-ascii?Q?u001=2EWtjZePZ3IDDBwtRucCmuQUiYSyr+JPf+ZmCYBVn7D93R7gFrWGyOlEszX?= =?us-ascii?Q?asxAGqvNvImWJtoLSflkInthJWIzhiIJGtsXbiv?= =?us-ascii?Q?25bKX5XDbEb8PcuKZOfipRc4gSnm1ulw1GU4=2FyI?= =?us-ascii?Q?G9FBw6chY+jOiA5gRq0zQkaMxj5R2uX3HOWiMlo?= =?us-ascii?Q?eLIYCOmXWIJrCRJuJmc+9dUSp9OIZWNnUmFw51s?= =?us-ascii?Q?gKswKA2vyFvMlUgEjcdoOmmga5zpCRupgT1ka1z?= =?us-ascii?Q?9p1HxfsYZk+ooJhntcFKPmVldA=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: 2UJLSM2VSGFSUOV3T4MSGAWPSGUFQOIE X-Message-ID-Hash: 2UJLSM2VSGFSUOV3T4MSGAWPSGUFQOIE X-MailFrom: bounces+313651-b711-ruby-core=ml.ruby-lang.org@em5188.ruby-lang.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:117630] [Ruby master Bug#20440] `super` from child class duplicating a keyword argument as a positional Hash List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "ozydingo (Andrew Schwartz) via ruby-core" Cc: "ozydingo (Andrew Schwartz)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20440 has been updated by ozydingo (Andrew Schwartz). Ok I see it now; `super` isn't passing the args as both forms, it's passing _only_ as a positional Hash. The `x: 1` is coming from my default kwarg, which I was blinded to as I attempted to reduce the example to a general form. Thanks all! ---------------------------------------- Bug #20440: `super` from child class duplicating a keyword argument as a positional Hash https://bugs.ruby-lang.org/issues/20440#change-108039 * Author: ozydingo (Andrew Schwartz) * Status: Closed * ruby -v: 3.3.0 * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- Apologies for the verbose title, but that's the specific set of conditions that AFAICT are required to reproduce the bug! Here's the simplest setup I can reproduce: ```rb class Base def foo(*args, x: 1) puts "Base: calling foo with args: #{args}, x: #{x}" end def foo!(x: 1) puts "Base: calling foo! with x: #{x}" foo(x: x) end end class Child < Base def foo(*) puts "Child: calling foo" super end end ``` When I call `Child.new.foo!`, I expect it to call the base class method `foo!`, which will use the default keyword arg `x: 1`; then the child method `foo` with `x: 1`, and finally the base method `foo` with `x: 1`. However, this is not what I observe: ```rb Child.new.foo! Base: calling foo! with x: 1 Child: calling foo Base: calling foo with args: [{:x=>1}], x: 1 ``` So when the child `foo` method called `super`, it passed not only `x: 1` as a keyword arg, but *also* `{x: 1}` as a Hash positional arg to the super method. This is breaking my upgrade to Ruby 3.0 as I have a similar setup but without the `*args` param, this I am getting the error "wrong number of arguments (given 1, expected 0)". -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/