No more SOE in UnusedSymbolInspection #KT-13536 Fixed
(cherry picked from commit 23961ee)
This commit is contained in:
committed by
Mikhail Glukhikh
parent
605ac0b25e
commit
6ac4bf3f17
@@ -263,8 +263,10 @@ class UnusedSymbolInspection : AbstractKotlinInspection() {
|
||||
}
|
||||
else {
|
||||
if (import.importedFqName != declaration.fqName) {
|
||||
val importedDeclaration = import.importedReference?.getQualifiedElementSelector()?.mainReference?.resolve() as? KtNamedDeclaration
|
||||
return importedDeclaration == null || !hasNonTrivialUsages(importedDeclaration)
|
||||
val importedDeclaration =
|
||||
import.importedReference?.getQualifiedElementSelector()?.mainReference?.resolve() as? KtNamedDeclaration
|
||||
return importedDeclaration == null ||
|
||||
(importedDeclaration != declaration && !hasNonTrivialUsages(importedDeclaration))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Safe delete 'MyEnum'" "false"
|
||||
// ACTION: Create test
|
||||
|
||||
import MyEnum.values
|
||||
|
||||
enum class <caret>MyEnum
|
||||
@@ -6928,6 +6928,12 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("importEnumValues.kt")
|
||||
public void testImportEnumValues() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/removeUnused/importEnumValues.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("notTriangle.kt")
|
||||
public void testNotTriangle() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/removeUnused/notTriangle.kt");
|
||||
|
||||
Reference in New Issue
Block a user