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=-2.8 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_PASS shortcircuit=no autolearn=no 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 EA72B202AA for ; Fri, 22 Feb 2019 14:52:37 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 00206121698; Fri, 22 Feb 2019 23:52:33 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id A1638121643 for ; Fri, 22 Feb 2019 23:52:31 +0900 (JST) Received: by filter0080p3las1.sendgrid.net with SMTP id filter0080p3las1-2085-5C700CAD-6 2019-02-22 14:52:29.431032287 +0000 UTC m=+55086.699605806 Received: from herokuapp.com (unknown [34.234.82.157]) by ismtpd0039p1iad1.sendgrid.net (SG) with ESMTP id fEBl-WzwQxiWoZcXCK8Hmw for ; Fri, 22 Feb 2019 14:52:28.783 +0000 (UTC) Date: Fri, 22 Feb 2019 14:52:30 +0000 (UTC) From: cianol@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 67060 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15616 X-Redmine-Issue-Author: cianooooo X-Redmine-Sender: cianooooo 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?apMKfMuuxirnr8FHwGnpiQjTbECpcLoHIXHi4vlFImN+nyBOsHulDOgeR=2FNvY+?= =?us-ascii?Q?NROSbc94gbsJEFIiwpNlDZB4chOfmzQN7eebUGw?= =?us-ascii?Q?KURcyiGoZ3oX0yl9gsflPbZEDt5Y8sU9PAcWb0p?= =?us-ascii?Q?XXxLSK75VVpFVmAvN2=2FDpmRUlr+ceFxbERIl7i8?= =?us-ascii?Q?x9T+butTdtswD?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 91609 Subject: [ruby-core:91609] [Ruby trunk Bug#15616] Chained destructive methods fail when using +@to unfreeze a frozen string 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 #15616 has been reported by cianooooo (Cian O). ---------------------------------------- Bug #15616: Chained destructive methods fail when using +@ to unfreeze a frozen string https://bugs.ruby-lang.org/issues/15616 * Author: cianooooo (Cian O) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: 2.6.1 * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- Using the +@ syntax to unfreeze a string does not work when chaining destructive methods Consider the following; ``` ruby foo = "bar".freeze +foo.gsub!("bar", "car") ``` This raises; ``` ruby FrozenError: can't modify frozen String ``` However, I would have expected this to work since +@ should return a duplicated mutable string. -- https://bugs.ruby-lang.org/