mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-13418 Unused whole multi-object-import when one of the imported objects not found
This commit is contained in:
+6
-1
@@ -997,7 +997,12 @@ public class PyUnresolvedReferencesInspection extends PyInspection {
|
||||
if (element == null) {
|
||||
if (importElement.getImportedQName() != null) {
|
||||
//Mark import as unused even if it can't be resolved
|
||||
result.add(importElement.getParent());
|
||||
if (areAllImportsUnused(importStatement, unusedImports)) {
|
||||
result.add(importStatement);
|
||||
}
|
||||
else {
|
||||
result.add(importElement);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
from library import foo,<error descr="Unresolved reference 'bar'">bar</error>
|
||||
|
||||
|
||||
print(foo)
|
||||
+1
@@ -0,0 +1 @@
|
||||
foo = 0
|
||||
+5
@@ -361,6 +361,11 @@ public class PyUnresolvedReferencesInspectionTest extends PyInspectionTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-13418
|
||||
public void testOneUnsedOneMarked() {
|
||||
doMultiFileTest();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected Class<? extends PyInspection> getInspectionClass() {
|
||||
|
||||
Reference in New Issue
Block a user