Fixed one more case of redundant type arguments
This commit is contained in:
@@ -128,6 +128,7 @@ class RemoveExplicitTypeArgumentsIntention : SelfTargetingOffsetIndependentInten
|
||||
if (element !is KtExpression) continue
|
||||
|
||||
if (element.getQualifiedExpressionForSelector() != null) continue
|
||||
if (element is KtFunctionLiteral) continue
|
||||
if (!element.isUsedAsExpression(bindingContext)) return element to null
|
||||
|
||||
val parent = element.parent
|
||||
|
||||
+9
@@ -214,4 +214,13 @@
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unnecessary type argument</problem_class>
|
||||
<description>Remove explicit type arguments</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>lambdaValue.kt</file>
|
||||
<line>5</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="lambdaValue.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unnecessary type argument</problem_class>
|
||||
<description>Remove explicit type arguments</description>
|
||||
</problem>
|
||||
</problems>
|
||||
@@ -0,0 +1,6 @@
|
||||
// IS_APPLICABLE: true
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(): List<String> = run {
|
||||
listOf<caret><String>()
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// IS_APPLICABLE: true
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(): List<String> = run {
|
||||
listOf()
|
||||
}
|
||||
@@ -12956,6 +12956,12 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaValue.kt")
|
||||
public void testLambdaValue() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/removeExplicitTypeArguments/lambdaValue.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("literalAny.kt")
|
||||
public void testLiteralAny() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/removeExplicitTypeArguments/literalAny.kt");
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
val d3 = Array<Array<IntArray>>(5) { arrayOfNulls<IntArray>(5) }
|
||||
val d3 = Array<Array<IntArray>>(5) { arrayOfNulls(5) }
|
||||
@@ -1 +1 @@
|
||||
val ss = Array<Array<String>>(5) { arrayOfNulls<String>(5) }
|
||||
val ss = Array<Array<String>>(5) { arrayOfNulls(5) }
|
||||
@@ -1 +1 @@
|
||||
val sss = Array(5) { Array<Array<String>>(5) { arrayOfNulls<String>(5) } }
|
||||
val sss = Array(5) { Array<Array<String>>(5) { arrayOfNulls(5) } }
|
||||
Reference in New Issue
Block a user