Remove check "unused secondary enum class constructor"

#KT-14040 Fixed
This commit is contained in:
Dmitry Gridin
2019-03-26 12:21:39 +07:00
parent dbe0b4aa71
commit d64702d87e
3 changed files with 18 additions and 0 deletions
@@ -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
}
@@ -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");