spec
spec copied to clipboard
[Ruby 3.4] Add tests for warning about mutating chilled Strings and String#+@
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: