You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since #6784, an input like ('a' * 20).freeze would cause Style/RedundantFreeze to say the freeze was not necessary. Since the parenthesised expression produces a mutable string, the freeze call is indeed necessary.
Expected behavior
Freezing the result of ('a' * 20) should be ok.
Actual behavior
Freezing the result of ('a' * 20) makes Style/RedundantFreeze to say the freeze is redundant.
Steps to reproduce the problem
❯ cat test.rb
('a' * 20).freeze
❯ bundle exec rubocop --only Style/RedundantFreeze -- test.rb
Inspecting 1 file
C
Offenses:
test.rb:1:1: C: Style/RedundantFreeze: Do not freeze immutable objects, as freezing them has no effect.
('a' * 20).freeze
^^^^^^^^^^^^^^^^^
1 file inspected, 1 offense detected
Since #6784, an input like
('a' * 20).freeze
would cause Style/RedundantFreeze to say thefreeze
was not necessary. Since the parenthesised expression produces a mutable string, thefreeze
call is indeed necessary.Expected behavior
Freezing the result of
('a' * 20)
should be ok.Actual behavior
Freezing the result of
('a' * 20)
makes Style/RedundantFreeze to say thefreeze
is redundant.Steps to reproduce the problem
RuboCop version
The text was updated successfully, but these errors were encountered: