diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/collections/UselessCallOnCollectionInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/collections/UselessCallOnCollectionInspection.kt index e1159491282..d67d05d56c3 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/collections/UselessCallOnCollectionInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/collections/UselessCallOnCollectionInspection.kt @@ -54,9 +54,10 @@ class UselessCallOnCollectionInspection : AbstractUselessCallInspection() { if (TypeUtils.isNullableType(receiverTypeArgument)) return if (calleeExpression.text != "filterNotNull") { // Also check last argument functional type to have not-null result - if (!resolvedCall.hasLastFunctionalParameterWithResult(context) { - !TypeUtils.isNullableType(it) && it.constructor !is TypeVariableTypeConstructor - }) return + val lastParameterMatches = resolvedCall.hasLastFunctionalParameterWithResult(context) { + !TypeUtils.isNullableType(it) && it.constructor !is TypeVariableTypeConstructor + } + if (!lastParameterMatches) return } }