Project

General

Profile

Bug #15616

Chained destructive methods fail when using +@ to unfreeze a frozen string

Added by cianooooo (Cian O) over 1 year ago. Updated over 1 year ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:91609]

Description

Using the +@ syntax to unfreeze a string does not work when chaining destructive methods

Consider the following;

foo = "bar".freeze
+foo.gsub!("bar", "car")

This raises;

FrozenError: can't modify frozen String

However, I would have expected this to work since +@ should return a duplicated mutable string.

Also available in: Atom PDF