From dc7dfc4ecf32b732d984c78c553467e24ff0f303 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Tue, 2 Apr 2024 11:09:57 +0200 Subject: [PATCH] [kotlin] k2 move lambda outside parenthesis: ensure explicit analyze call only in `prepareContext` ^KTIJ-29256 fixed GitOrigin-RevId: 0352241c45b8596e6cc8f9ec646bd3470328b8d5 --- .../inspections/MoveLambdaOutsideParenthesesInspection.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/kotlin/code-insight/inspections-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/inspections/MoveLambdaOutsideParenthesesInspection.kt b/plugins/kotlin/code-insight/inspections-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/inspections/MoveLambdaOutsideParenthesesInspection.kt index 0e931b62cc99..2038347dbf88 100644 --- a/plugins/kotlin/code-insight/inspections-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/inspections/MoveLambdaOutsideParenthesesInspection.kt +++ b/plugins/kotlin/code-insight/inspections-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/inspections/MoveLambdaOutsideParenthesesInspection.kt @@ -47,10 +47,9 @@ internal class MoveLambdaOutsideParenthesesInspection : KotlinApplicableInspecti } } - override fun isApplicableByPsi(element: KtCallExpression): Boolean = element.canMoveLambdaOutsideParentheses(skipComplexCalls = false) - context(KtAnalysisSession) - override fun prepareContext(element: KtCallExpression) { + override fun prepareContext(element: KtCallExpression): Unit? { + return if (!element.canMoveLambdaOutsideParentheses(skipComplexCalls = false)) null else Unit } override fun createQuickFix(