Skip to content

Rename and inline refactor did not recognize type alias statements as variable assignment #862

Description

@lieryan

Describe the bug

The type alias statement is a new kind of assignment statement since Python 3.12+. Currently they are not recognised as assignment statement that can define a variable.

To Reproduce
Steps to reproduce the behavior:

  1. Code before refactoring:
type old_name_1 = int
x: old_name_1 = 1

type Alias[old_name_2] = list[old_name_2]
print(old_name_2) # this should be untouched
  1. Describe the refactoring you want to do: rename old_name_xxx to new_name_xxx

  2. Expected code after refactoring:

type new_name_1 = int
x: new_name_1 = 1

type Alias[new_name_2] = list[new_name_2]
print(old_name_2) # this should be untouched
  1. Describe the error or unexpected result that you are getting
RefactoringError: Rename refactoring should be performed on resolvable python identifiers

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnexpected or incorrect user-visible behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions