ReplaceToWithInfixFormInspection: don't report when call expression has type typeArguments
#KT-36508 Fixed
This commit is contained in:
committed by
Yan Zhulanow
parent
f7a69d4aa7
commit
8d3e41ae60
@@ -26,7 +26,8 @@ class ReplaceToWithInfixFormInspection : AbstractKotlinInspection() {
|
||||
|
||||
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {
|
||||
return dotQualifiedExpressionVisitor(fun(expression) {
|
||||
if (expression.callExpression?.valueArguments?.size != 1) return
|
||||
val callExpression = expression.callExpression ?: return
|
||||
if (callExpression.valueArguments.size != 1 || callExpression.typeArgumentList != null) return
|
||||
if (expression.calleeName !in compatibleNames) return
|
||||
|
||||
val resolvedCall = expression.resolveToCall() ?: return
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// PROBLEM: none
|
||||
// WITH_RUNTIME
|
||||
class Receiver(val x: Int = 0)
|
||||
class Argument(val y: Int = 1)
|
||||
|
||||
val test = <caret>"".to<String, Receiver.(Argument) -> Unit> {
|
||||
println(x)
|
||||
println(it.y)
|
||||
}
|
||||
+5
@@ -11450,6 +11450,11 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
|
||||
public void testNonPair() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/replaceToWithInfixForm/nonPair.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeArguments.kt")
|
||||
public void testTypeArguments() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/replaceToWithInfixForm/typeArguments.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/inspectionsLocal/replaceWithEnumMap")
|
||||
|
||||
Reference in New Issue
Block a user