PY-83118 Forward Reference Causes Import to Be Incorrectly Removed in PyCharm 2025.2

(cherry picked from commit fcf27e5c97e12498bc1c630f43e0a0876faba408)

IJ-CR-172300

GitOrigin-RevId: 7f3fcc83890a4ae0b0e7e6dd4ba363790f318eaa
This commit is contained in:
Andrey Vokin
2025-08-13 12:51:21 +02:00
committed by intellij-monorepo-bot
parent 382e4d0783
commit b3a70daa05
4 changed files with 17 additions and 0 deletions

View File

@@ -91,6 +91,9 @@ class PyUnusedImportsInspection : PyInspection() {
override fun visitPyElement(node: PyElement) {
super.visitPyElement(node)
if (node is PsiLanguageInjectionHost) {
processInjection(node)
}
if (node is PyReferenceOwner) {
val resolveContext = PyResolveContext.defaultContext(myTypeEvalContext)
processReference(node, node.getReference(resolveContext))