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: X-Spam-Status: No, score=-2.9 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [IPv6:2a01:4f8:1c0c:6b10::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 8DBD21F4C1 for ; Thu, 1 Dec 2022 05:15:34 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.b="eDL/PVhE"; dkim-atps=neutral Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id A1B777E5B0; Thu, 1 Dec 2022 05:15:27 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; 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=eDL/PVhE; dkim-atps=neutral Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 0A3F07E5A8 for ; Thu, 1 Dec 2022 05:15:23 +0000 (UTC) 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; s=s1; bh=/SN5CgnI8cXBAp8UwvbCV2gEAoMr1UEzuax6wge5vVI=; b=eDL/PVhEUoNiAulzjwFS+6w1KlQwWzjrZqdSWY74AgkosjumiiiDIgPK1wVc/C9gV8OH 4ZCdgwP9flLKYSLva4rrZTSuVKKHi7NbfoSHQWKi5C98Sfpwnv7QV7XMOMQ+uta9w8r70Z 1YuxrC2D+ZuY4Q/mJa0TEd+z0LP7xNzNwOKIYpvC2kiZxPhz1zebehJi7bM88DQHQ3NFPf mZnYELJaJmMXEKFJylyNU2YW0NJ8qJyIPWrRstUZJ4dfM9pykftKLcbND2vWvIlafy9wxk 1EFR9izlVi3jD7lxMP/8pPywB1vykr4bevaI50PlQFlfWODrhidCTSGd2dZcXHuQ== Received: by filterdrecv-69c5db5cf4-qmzzj with SMTP id filterdrecv-69c5db5cf4-qmzzj-1-6388386A-29 2022-12-01 05:15:22.47812112 +0000 UTC m=+1145230.364689183 Received: from herokuapp.com (unknown) by geopod-ismtpd-4-3 (SG) with ESMTP id 5cJkp3KySeOnWJIlDdrvkQ for ; Thu, 01 Dec 2022 05:15:22.317 +0000 (UTC) Date: Thu, 01 Dec 2022 05:15:22 +0000 (UTC) From: "matz (Yukihiro Matsumoto)" Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 19047 X-Redmine-Issue-Author: jonathanhefner X-Redmine-Sender: matz 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: 87455 X-SG-EID: =?us-ascii?Q?SqOeWfVKFgkgw8cVgc6MYslIG5ZBbSbWU3opJ5u4yBsU3yWoizgPd1Pss4ZMTd?= =?us-ascii?Q?OLBRodnvQO26=2FFyqng1x72rdTkbmTHg5l1+yKA9?= =?us-ascii?Q?AQWjb6nWgGxIfg+GcAbhedIdy4vUqvArUOB809I?= =?us-ascii?Q?UmgivXGslyASjXZSjLzqpEwhJb1FnFE53vm1JwD?= =?us-ascii?Q?f=2FhFyr7fAkfEVTTO4OsFawCSN1KVuULUFOPT6ux?= =?us-ascii?Q?Wa=2Fi7x5KSyc9FRKBLqyX58b9+Ar4zoUb72i8UTD?= =?us-ascii?Q?OlpdiEKGWOHWZQe7nCq9g=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== Message-ID-Hash: 35GOUK2IRSQ75CO667LKP3ZCZXPQ4SRB X-Message-ID-Hash: 35GOUK2IRSQ75CO667LKP3ZCZXPQ4SRB 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:111105] [Ruby master Bug#19047] DelegateClass displays "method redefined" warning when overriding methods List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #19047 has been updated by matz (Yukihiro Matsumoto). Sorry, but by this change, we missed the warnings from DelegateClass misuse. We will revert this change. Matz. ---------------------------------------- Bug #19047: DelegateClass displays "method redefined" warning when overriding methods https://bugs.ruby-lang.org/issues/19047#change-100373 * Author: jonathanhefner (Jonathan Hefner) * Status: Closed * Priority: Normal * ruby -v: ruby 3.1.2p20 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- Perhaps this is not a bug, but it does seem unexpected. When creating a `DelegateClass` class without an intervening ancestor, overriding a method displays "method redefined" warning: ```ruby Base = Class.new do def foo "foo" end end Delegate1 = DelegateClass(Base) do def foo super + "1" end end # warning: method redefined; discarding old foo Delegate2 = Class.new(DelegateClass(Base)) do def foo super + "2" end end # no warning Delegate1.new(Base.new).foo # => "foo1" Delegate2.new(Base.new).foo # => "foo2" ``` One possible solution would be to evaluate the `DelegateClass` block in a separate module, and prepend that module to the returned class. Another possible solution would be to silence warnings around [when the block is evaluated](https://github.com/ruby/delegate/blob/df2283b8d8874446086b80355c586397f1b48d53/lib/delegate.rb#L442). I would be happy to submit a PR to https://github.com/ruby/delegate if this is something we want to address. -- 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/