Skip to content

Scalafix rename that leads to a name collision breaks compilation #1305

Open
@mosesn

Description

@mosesn

Problem

If a rename causes a collision in the renamed file, you can no longer compile the file. Scalafix does not deal with the collision gracefully.

Proposed Solution

We can infer if the Scalafix rename would cause a collision by inspecting the identifiers that are at the scope of the import when it's renamed. This will be a little tricky (I believe imports are evaluated in order) as we want to know about all of the identifiers that come from imports. If the rename would cause a collision, we inline the fully qualified name and delete the old import, instead of performing the rename.

Next Steps

If someone is inspired to tackle this problem, I would be very grateful! If no one is feeling so inspired, I can take a stab at working on this, but I'll need guidance, since I'm a scalafix newb.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions