[ruby-core:120305] [Ruby master Bug#20966] Unary plus String warns about freezing
From:
"getajobmike (Mike Perham) via ruby-core" <ruby-core@...>
Date:
2024-12-18 23:20:01 UTC
List:
ruby-core #120305
Issue #20966 has been updated by getajobmike (Mike Perham).
Subject changed from Unary to Unary plus String warns about freezing
My code:
```
header = +"\x1f\x8b".force_encoding("BINARY")
```
Rubocop says "Use unary plus to get an unfrozen string literal."
But Ruby 3.4rc1 says:
```
profiling_test.rb:49: warning: literal string will be frozen in the future (run with --debug-frozen-string-literal for more information)
```
Should `+"string"` issue a warning like that?
----------------------------------------
Bug #20966: Unary plus String warns about freezing
https://bugs.ruby-lang.org/issues/20966#change-111070
* Author: getajobmike (Mike Perham)
* Status: Open
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
/Users/mperham/src/sidekiq/test/profiling_test.rb:49: warning: literal string will be frozen in the future (run with --debug-frozen-string-literal for more information)
--
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/lists/ruby-core.ml.ruby-lang.org/