Optimize UsePropertyAccessSyntaxInspection

This commit is contained in:
Mikhail Glukhikh
2018-03-27 19:11:54 +02:00
parent 52cd71c3c4
commit b8da1d67d5
@@ -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)