Add type aliases into UnusedSymbolInspection / safe delete
So #KT-16046 Fixed
This commit is contained in:
@@ -145,6 +145,7 @@ class UnusedSymbolInspection : AbstractKotlinInspection() {
|
|||||||
is KtSecondaryConstructor -> "Constructor is never used"
|
is KtSecondaryConstructor -> "Constructor is never used"
|
||||||
is KtProperty, is KtParameter -> "Property ''$name'' is never used"
|
is KtProperty, is KtParameter -> "Property ''$name'' is never used"
|
||||||
is KtTypeParameter -> "Type parameter ''$name'' is never used"
|
is KtTypeParameter -> "Type parameter ''$name'' is never used"
|
||||||
|
is KtTypeAlias -> "Type alias ''$name'' is never used"
|
||||||
else -> return
|
else -> return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ fun PsiElement.canDeleteElement(): Boolean {
|
|||||||
|| this is PsiClass
|
|| this is PsiClass
|
||||||
|| this is KtProperty
|
|| this is KtProperty
|
||||||
|| this is KtTypeParameter
|
|| this is KtTypeParameter
|
||||||
|
|| this is KtTypeAlias
|
||||||
}
|
}
|
||||||
|
|
||||||
fun PsiElement.removeOverrideModifier() {
|
fun PsiElement.removeOverrideModifier() {
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<problems>
|
||||||
|
<problem>
|
||||||
|
<file>test.kt</file>
|
||||||
|
<line>4</line>
|
||||||
|
<module>light_idea_test_case</module>
|
||||||
|
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
|
||||||
|
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused symbol</problem_class>
|
||||||
|
<description>Type alias ''YourString'' is never used</description>
|
||||||
|
</problem>
|
||||||
|
<problem>
|
||||||
|
<file>test.kt</file>
|
||||||
|
<line>6</line>
|
||||||
|
<module>light_idea_test_case</module>
|
||||||
|
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
|
||||||
|
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused symbol</problem_class>
|
||||||
|
<description>Property ''ms'' is never used</description>
|
||||||
|
</problem>
|
||||||
|
</problems>
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.UnusedSymbolInspection
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
typealias MyString = String
|
||||||
|
|
||||||
|
// unused
|
||||||
|
typealias YourString = String
|
||||||
|
|
||||||
|
val ms: MyString = ""
|
||||||
@@ -413,6 +413,12 @@ public class InspectionTestGenerated extends AbstractInspectionTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("unusedSymbol/typeAlias/inspectionData/inspections.test")
|
||||||
|
public void testUnusedSymbol_typeAlias_inspectionData_Inspections_test() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspections/unusedSymbol/typeAlias/inspectionData/inspections.test");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("unusedSymbol/typeParameter/inspectionData/inspections.test")
|
@TestMetadata("unusedSymbol/typeParameter/inspectionData/inspections.test")
|
||||||
public void testUnusedSymbol_typeParameter_inspectionData_Inspections_test() throws Exception {
|
public void testUnusedSymbol_typeParameter_inspectionData_Inspections_test() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspections/unusedSymbol/typeParameter/inspectionData/inspections.test");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspections/unusedSymbol/typeParameter/inspectionData/inspections.test");
|
||||||
|
|||||||
Reference in New Issue
Block a user