mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[kotlin] SuspiciousImplicitCoroutineScopeReceiverAccess: avoid endless loop
- when parameter type is a flexible type KTIJ-39388 (cherry picked from commit 915620ede97aa559cc284b4210492ded9a07e408) IJ-CR-218907 GitOrigin-RevId: 408de3946732089f7ef2bd64a4f64b564453e31e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
16fc65741d
commit
32b66c7d87
+1
-1
@@ -162,7 +162,7 @@ internal class SuspiciousImplicitCoroutineScopeReceiverAccessInspection :
|
||||
samConstructor?.samConstructorLambdaParameterType
|
||||
} else {
|
||||
parameterType
|
||||
} ?: continue
|
||||
} ?: return false
|
||||
|
||||
if (lambdaType.isSuspendFunctionType && !isAllowedSuspendingFunction(functionSymbol)) {
|
||||
return true
|
||||
|
||||
+5
@@ -16307,6 +16307,11 @@ public abstract class K2LocalInspectionTestGenerated extends AbstractK2LocalInsp
|
||||
runTest("testData/inspectionsLocal/coroutines/ambiguousCoroutineScope/functionExtensionReceiver_suspendWrapper_suspendFunInterface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionExtensionReceiver_suspendWrapper_suspendFunInterfaceJava.kt")
|
||||
public void testFunctionExtensionReceiver_suspendWrapper_suspendFunInterfaceJava() throws Exception {
|
||||
runTest("testData/inspectionsLocal/coroutines/ambiguousCoroutineScope/functionExtensionReceiver_suspendWrapper_suspendFunInterfaceJava.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionExtensionReceiver_suspendWrapper_suspendFunInterface_explicitSamConstructor.kt")
|
||||
public void testFunctionExtensionReceiver_suspendWrapper_suspendFunInterface_explicitSamConstructor() throws Exception {
|
||||
runTest("testData/inspectionsLocal/coroutines/ambiguousCoroutineScope/functionExtensionReceiver_suspendWrapper_suspendFunInterface_explicitSamConstructor.kt");
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package test
|
||||
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
||||
interface CustomSuspendLambda {
|
||||
void customInvoke();
|
||||
}
|
||||
|
||||
class Main {
|
||||
static void suspendWrapper(CustomSuspendLambda action) {
|
||||
action.customInvoke();
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// WITH_COROUTINES
|
||||
// PROBLEM: none
|
||||
package test
|
||||
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
||||
|
||||
fun CoroutineScope.doStuff() {}
|
||||
|
||||
suspend fun CoroutineScope.test() {
|
||||
Main.suspendWrapper {
|
||||
<caret>doStuff()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user