diff --git a/idea/src/org/jetbrains/kotlin/idea/editor/fixers/KotlinLastLambdaParameterFixer.kt b/idea/src/org/jetbrains/kotlin/idea/editor/fixers/KotlinLastLambdaParameterFixer.kt index 0883303316d..ef8107f50c3 100644 --- a/idea/src/org/jetbrains/kotlin/idea/editor/fixers/KotlinLastLambdaParameterFixer.kt +++ b/idea/src/org/jetbrains/kotlin/idea/editor/fixers/KotlinLastLambdaParameterFixer.kt @@ -19,11 +19,9 @@ package org.jetbrains.kotlin.idea.editor.fixers import com.intellij.lang.SmartEnterProcessorWithFixers import com.intellij.openapi.editor.Editor import com.intellij.psi.PsiElement -import com.intellij.psi.impl.source.tree.LeafPsiElement import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.editor.KotlinSmartEnterHandler -import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.KtCallExpression import org.jetbrains.kotlin.psi.psiUtil.endOffset import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall @@ -31,15 +29,8 @@ import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode class KotlinLastLambdaParameterFixer : SmartEnterProcessorWithFixers.Fixer() { override fun apply(editor: Editor, processor: KotlinSmartEnterHandler, element: PsiElement) { - if (element is KtCallExpression) { - addBracesIfNecessary(editor, element, processor) - } - else if (element is LeafPsiElement) { - registerErrorIfNecessary(element, processor) - } - } + if (element !is KtCallExpression) return - private fun addBracesIfNecessary(editor: Editor, element: KtCallExpression, processor: KotlinSmartEnterHandler) { val bindingContext = element.analyze(BodyResolveMode.PARTIAL) val resolvedCall = element.getResolvedCall(bindingContext) ?: return @@ -56,16 +47,10 @@ class KotlinLastLambdaParameterFixer : SmartEnterProcessorWithFixers.Fixer Unit) { } fun test() { - foo(Any()) { } + foo(Any()) { } } """ ) - fun testExtensionLambdaParamImplicit1() = doFileTest( + fun testExtensionLambdaParam() = doFileTest( """ fun foo(a: Any, block: Any.() -> Unit) { } @@ -1312,7 +1312,7 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() { fun foo(a: Any, block: Any.() -> Unit) { } fun test() { - foo(Any()) { } + foo(Any()) { } } """ )