From b8da1d67d5f92ee5440c527e8c736247dcf5ab7c Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 27 Mar 2018 19:11:54 +0200 Subject: [PATCH] Optimize UsePropertyAccessSyntaxInspection --- .../kotlin/idea/intentions/UsePropertyAccessSyntaxIntention.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/UsePropertyAccessSyntaxIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/UsePropertyAccessSyntaxIntention.kt index 02e5a0ff2d6..3f0a7dfa890 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/UsePropertyAccessSyntaxIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/UsePropertyAccessSyntaxIntention.kt @@ -51,6 +51,7 @@ import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode import org.jetbrains.kotlin.resolve.scopes.LexicalScope import org.jetbrains.kotlin.resolve.scopes.SyntheticScopes import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor +import org.jetbrains.kotlin.synthetic.canBePropertyAccessor import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.types.typeUtil.isUnit @@ -125,6 +126,7 @@ class UsePropertyAccessSyntaxIntention : SelfTargetingOffsetIndependentIntention if (callExpression.getQualifiedExpressionForSelector()?.receiverExpression is KtSuperExpression) return null // cannot call extensions on "super" val callee = callExpression.calleeExpression as? KtNameReferenceExpression ?: return null + if (!canBePropertyAccessor(callee.getReferencedName())) return null val resolutionFacade = callExpression.getResolutionFacade() val bindingContext = resolutionFacade.analyze(callExpression, BodyResolveMode.PARTIAL_FOR_COMPLETION)