Remove check "unused secondary enum class constructor"
#KT-14040 Fixed
This commit is contained in:
@@ -198,6 +198,7 @@ class UnusedSymbolInspection : AbstractKotlinInspection() {
|
||||
// Simple PSI-based checks
|
||||
if (declaration is KtObjectDeclaration && declaration.isCompanion()) return // never mark companion object as unused (there are too many reasons it can be needed for)
|
||||
|
||||
if (declaration is KtSecondaryConstructor && declaration.containingClass()?.isEnum() == true) return
|
||||
if (declaration.hasModifier(KtTokens.OVERRIDE_KEYWORD)) return
|
||||
if (declaration is KtProperty && declaration.isLocal) return
|
||||
if (declaration is KtParameter && (declaration.getParent().parent !is KtPrimaryConstructor || !declaration.hasValOrVar())) return
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
// PROBLEM: none
|
||||
enum class MyEnum(val i: Int) {
|
||||
HELLO(42),
|
||||
WORLD("42")
|
||||
;
|
||||
|
||||
constructor<caret>(s: String): this(42)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
MyEnum.HELLO
|
||||
}
|
||||
+5
@@ -8673,6 +8673,11 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
|
||||
runTest("idea/testData/inspectionsLocal/unusedSymbol/dataInlineClassDeclaration.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("enumSecondaryConstructor.kt")
|
||||
public void testEnumSecondaryConstructor() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/unusedSymbol/enumSecondaryConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionWithInlineClass.kt")
|
||||
public void testFunctionWithInlineClass() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/unusedSymbol/functionWithInlineClass.kt");
|
||||
|
||||
Reference in New Issue
Block a user