mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[kotlin] unused symbol: disable for parameters of anonymous functions
- it's not cheap to check if the function has an explicit expected type, k1 ignored parameters anyway ^KTIJ-35651 fixed GitOrigin-RevId: b1798d0a67e14fbf4abb798168be71848b86d549
This commit is contained in:
committed by
intellij-monorepo-bot
parent
21c9c4884e
commit
de83ec0069
+10
@@ -202,6 +202,16 @@ public abstract class K2UnusedSymbolHighlightingTestGenerated extends AbstractK2
|
||||
runTest("../../../idea/tests/testData/inspectionsLocal/unusedSymbol/annotationWithUseSiteTarget.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousFunction.kt")
|
||||
public void testAnonymousFunction() throws Exception {
|
||||
runTest("../../../idea/tests/testData/inspectionsLocal/unusedSymbol/anonymousFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousFunction1.kt")
|
||||
public void testAnonymousFunction1() throws Exception {
|
||||
runTest("../../../idea/tests/testData/inspectionsLocal/unusedSymbol/anonymousFunction1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("arrayAccessOperator.kt")
|
||||
public void testArrayAccessOperator() throws Exception {
|
||||
runTest("../../../idea/tests/testData/inspectionsLocal/unusedSymbol/arrayAccessOperator.kt");
|
||||
|
||||
+3
@@ -103,6 +103,9 @@ object K2UnusedSymbolUtil {
|
||||
if (isExpectedOrActual(containingClass)) return false
|
||||
}
|
||||
} else if (ownerFunction is KtFunction) {
|
||||
if (ownerFunction.name == null) {
|
||||
return false
|
||||
}
|
||||
if (ownerFunction.hasModifier(KtTokens.OPERATOR_KEYWORD)) {
|
||||
// operator parameters are hardcoded to be used since they can't be removed at will, because operator convention would break
|
||||
return false
|
||||
|
||||
+10
@@ -16610,6 +16610,16 @@ public abstract class LocalInspectionTestGenerated extends AbstractLocalInspecti
|
||||
runTest("testData/inspectionsLocal/unusedSymbol/annotationWithUseSiteTarget.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousFunction.kt")
|
||||
public void testAnonymousFunction() throws Exception {
|
||||
runTest("testData/inspectionsLocal/unusedSymbol/anonymousFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousFunction1.kt")
|
||||
public void testAnonymousFunction1() throws Exception {
|
||||
runTest("testData/inspectionsLocal/unusedSymbol/anonymousFunction1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("arrayAccessOperator.kt")
|
||||
public void testArrayAccessOperator() throws Exception {
|
||||
runTest("testData/inspectionsLocal/unusedSymbol/arrayAccessOperator.kt");
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// PROBLEM: none
|
||||
// WITH_STDLIB
|
||||
fun foo(p: (String) -> Unit) {
|
||||
p("")
|
||||
}
|
||||
|
||||
fun use() {
|
||||
foo(
|
||||
fun(i<caret>t: String) {
|
||||
print("foo")
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// PROBLEM: none
|
||||
// WITH_STDLIB
|
||||
fun use() {
|
||||
val f = fun(i<caret>t: String) {
|
||||
print("foo")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user