spec icon indicating copy to clipboard operation
spec copied to clipboard

[Ruby 3.4] Add tests for warning about mutating chilled Strings and String#+@

Open trinistr opened this issue 2 months ago • 0 comments

From #1265.

String literals in files without a frozen_string_literal comment now emit a deprecation warning when they are mutated. These warnings can be enabled with -W:deprecated or by setting Warning[:deprecated] = true. To disable this change, you can run Ruby with the --disable-frozen-string-literal command line argument. [Feature #20205]

  • String#+@ now duplicates when mutating the string would emit a deprecation warning, offered as a replacement for the str.dup if str.frozen? pattern.

Maybe this needs to be squashed? But they are separate things :shrug:

trinistr avatar Nov 11 '25 21:11 trinistr