mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-22 15:51:33 +00:00
Unused symbol: do not search for internal member light methods
Use direct references search instead So #KT-19811 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
4428798c61
commit
5c4e034171
@@ -274,7 +274,7 @@ class UnusedSymbolInspection : AbstractKotlinInspection() {
|
||||
return false
|
||||
}
|
||||
|
||||
if (declaration is KtCallableDeclaration) {
|
||||
if (declaration is KtCallableDeclaration && !declaration.hasModifier(KtTokens.INTERNAL_KEYWORD)) {
|
||||
val lightMethods = declaration.toLightMethods()
|
||||
if (lightMethods.isNotEmpty()) {
|
||||
return lightMethods.any { method ->
|
||||
|
||||
1
idea/testData/inspectionsLocal/unusedSymbol/.inspection
vendored
Normal file
1
idea/testData/inspectionsLocal/unusedSymbol/.inspection
vendored
Normal file
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.inspections.UnusedSymbolInspection
|
||||
9
idea/testData/inspectionsLocal/unusedSymbol/internal.kt
vendored
Normal file
9
idea/testData/inspectionsLocal/unusedSymbol/internal.kt
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
// PROBLEM: none
|
||||
|
||||
class Foo {
|
||||
fun test() {
|
||||
abacaba("")
|
||||
}
|
||||
|
||||
internal fun <caret>abacaba(s: String): String = s
|
||||
}
|
||||
@@ -1842,6 +1842,21 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/inspectionsLocal/unusedSymbol")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class UnusedSymbol extends AbstractLocalInspectionTest {
|
||||
public void testAllFilesPresentInUnusedSymbol() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/unusedSymbol"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("internal.kt")
|
||||
public void testInternal() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/unusedSymbol/internal.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/inspectionsLocal/useExpressionBody")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user