diff --git a/plugins/kotlin/code-insight/inspections-k2/src/org/jetbrains/kotlin/idea/codeInsight/inspections/coroutines/SuspiciousImplicitCoroutineScopeReceiverAccessInspection.kt b/plugins/kotlin/code-insight/inspections-k2/src/org/jetbrains/kotlin/idea/codeInsight/inspections/coroutines/SuspiciousImplicitCoroutineScopeReceiverAccessInspection.kt index 30dad4aea743..1d847e2df0c1 100644 --- a/plugins/kotlin/code-insight/inspections-k2/src/org/jetbrains/kotlin/idea/codeInsight/inspections/coroutines/SuspiciousImplicitCoroutineScopeReceiverAccessInspection.kt +++ b/plugins/kotlin/code-insight/inspections-k2/src/org/jetbrains/kotlin/idea/codeInsight/inspections/coroutines/SuspiciousImplicitCoroutineScopeReceiverAccessInspection.kt @@ -152,7 +152,7 @@ internal class SuspiciousImplicitCoroutineScopeReceiverAccessInspection : } // Check if the matching parameter's return type is a suspend type - val (functionSymbol, argumentSymbol) = getCallExpressionSymbol(current) ?: continue + val (functionSymbol, argumentSymbol) = getCallExpressionSymbol(current) ?: return false // Resolve the outer call of the lambda val parameterType = argumentSymbol.returnType diff --git a/plugins/kotlin/code-insight/inspections-k2/tests/test/org/jetbrains/kotlin/idea/inspections/tests/K2LocalInspectionTestGenerated.java b/plugins/kotlin/code-insight/inspections-k2/tests/test/org/jetbrains/kotlin/idea/inspections/tests/K2LocalInspectionTestGenerated.java index c5f3f73cd1f9..e0d5b3ba3e55 100644 --- a/plugins/kotlin/code-insight/inspections-k2/tests/test/org/jetbrains/kotlin/idea/inspections/tests/K2LocalInspectionTestGenerated.java +++ b/plugins/kotlin/code-insight/inspections-k2/tests/test/org/jetbrains/kotlin/idea/inspections/tests/K2LocalInspectionTestGenerated.java @@ -16347,6 +16347,11 @@ public abstract class K2LocalInspectionTestGenerated extends AbstractK2LocalInsp runTest("testData/inspectionsLocal/coroutines/ambiguousCoroutineScope/lambdaExtensionReceiver_withLabel_suspendWrapper.kt"); } + @TestMetadata("selectBuilderProperty.kt") + public void testSelectBuilderProperty() throws Exception { + runTest("testData/inspectionsLocal/coroutines/ambiguousCoroutineScope/selectBuilderProperty.kt"); + } + @TestMetadata("selectExpression.kt") public void testSelectExpression() throws Exception { runTest("testData/inspectionsLocal/coroutines/ambiguousCoroutineScope/selectExpression.kt"); diff --git a/plugins/kotlin/code-insight/inspections-k2/tests/testData/inspectionsLocal/coroutines/ambiguousCoroutineScope/selectBuilderProperty.kt b/plugins/kotlin/code-insight/inspections-k2/tests/testData/inspectionsLocal/coroutines/ambiguousCoroutineScope/selectBuilderProperty.kt new file mode 100644 index 000000000000..c3c7793ea977 --- /dev/null +++ b/plugins/kotlin/code-insight/inspections-k2/tests/testData/inspectionsLocal/coroutines/ambiguousCoroutineScope/selectBuilderProperty.kt @@ -0,0 +1,19 @@ +// WITH_COROUTINES +// PROBLEM: none +package test + +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.async +import kotlinx.coroutines.selects.SelectBuilder + +fun CoroutineScope.doStuff() {} + +suspend fun CoroutineScope.test() { + val deferred = async { 42 } + + val p: SelectBuilder.() -> Unit = { + deferred.onAwait { + doStuff() + } + } +}