diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuspendCallLineMarkerProvider.kt b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuspendCallLineMarkerProvider.kt index 53689bd3b32..c346aa32a1e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuspendCallLineMarkerProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuspendCallLineMarkerProvider.kt @@ -79,6 +79,7 @@ private fun KtExpression.isValidCandidateExpression(): Boolean { if (this is KtOperationReferenceExpression || this is KtForExpression || this is KtProperty || this is KtNameReferenceExpression) return true val parent = parent if (parent is KtCallExpression && parent.calleeExpression == this) return true + if (this is KtCallExpression && this.calleeExpression is KtCallExpression) return true return false } diff --git a/idea/testData/inspections/redundantSuspendModifier/operators.kt b/idea/testData/inspections/redundantSuspendModifier/operators.kt index 053b6f46563..a0d7150576e 100644 --- a/idea/testData/inspections/redundantSuspendModifier/operators.kt +++ b/idea/testData/inspections/redundantSuspendModifier/operators.kt @@ -37,6 +37,11 @@ class C(val x: Int, val y: Int) { suspend operator fun invoke() = x + y } +// Not redundant +suspend fun bar(): Int { + return C(1, 2)() +} + // Not redundant suspend fun foo(c1: C, c2: C): Int { return c1() + c2()