From 682a61ad26c988e545993d62f9eb89c3d122198c Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Mon, 11 Jan 2016 19:05:37 +0100 Subject: [PATCH] use PARTIAL_FOR_COMPLETION resolve mode when checking whether reference will resolve to the property, otherwise we're going to miss local variables which shadow the property --- .../idea/intentions/UsePropertyAccessSyntaxIntention.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/UsePropertyAccessSyntaxIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/UsePropertyAccessSyntaxIntention.kt index f3bec35c3da..84e2efc5900 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/UsePropertyAccessSyntaxIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/UsePropertyAccessSyntaxIntention.kt @@ -24,11 +24,11 @@ import org.jetbrains.kotlin.diagnostics.Severity import org.jetbrains.kotlin.idea.analysis.analyzeInContext import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade import org.jetbrains.kotlin.idea.core.copied -import org.jetbrains.kotlin.idea.util.getResolutionScope import org.jetbrains.kotlin.idea.core.replaced import org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection import org.jetbrains.kotlin.idea.resolve.ResolutionFacade import org.jetbrains.kotlin.idea.resolve.frontendService +import org.jetbrains.kotlin.idea.util.getResolutionScope import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.getQualifiedExpressionForSelector @@ -80,7 +80,7 @@ class UsePropertyAccessSyntaxIntention : SelfTargetingOffsetIndependentIntention val callee = callExpression.calleeExpression as? KtNameReferenceExpression ?: return null val resolutionFacade = callExpression.getResolutionFacade() - val bindingContext = resolutionFacade.analyze(callExpression, BodyResolveMode.PARTIAL) + val bindingContext = resolutionFacade.analyze(callExpression, BodyResolveMode.PARTIAL_FOR_COMPLETION) val resolvedCall = callExpression.getResolvedCall(bindingContext) ?: return null if (!resolvedCall.isReallySuccess()) return null