Rename: Substitute synthetic expression parent before analysis

This fixes rename conflicts test
This commit is contained in:
Alexey Sedunov
2018-02-02 15:10:09 +03:00
parent 049439ce1d
commit adca8eb7f1
4 changed files with 22 additions and 6 deletions
@@ -44,6 +44,7 @@ import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.*
import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DelegatingBindingTrace
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.kotlin.resolve.calls.resolvedCallUtil.getExplicitReceiverValue
@@ -288,7 +289,8 @@ private fun checkUsagesRetargeting(
newCallee.getReferencedNameElement().replace(psiFactory.createNameIdentifier(name))
}
val newContext = qualifiedExpression.analyzeInContext(scope, refElement)
qualifiedExpression.parentSubstitute = fullCallExpression.parent
val newContext = qualifiedExpression.analyzeInContext(scope, refElement, DelegatingBindingTrace(context, ""))
val newResolvedCall = newCallee.getResolvedCall(newContext)
val candidateText = newResolvedCall?.candidateDescriptor?.getImportableDescriptor()?.canonicalRender()