Skip to content

UnfreezeString autocorrect incorrectly handles .force_encoding #252

@johnnyshields

Description

@johnnyshields

The autocorrect for:

String.new.force_encoding('Ascii')

gave me:

# BAD - raises FrozenError (can't modify frozen String)
+''.force_encoding('Ascii')

Instead it should add parenthesis

# GOOD
(+'').force_encoding('Ascii')

Please check if there are other affected methods... I haven't tested but imagine you are already handling bang (!) methods properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions