Fix CCE in move-refactoring

It happens when companion object's descriptor doesn't correspond to PSI object declaration

#EA-126981 fixed
This commit is contained in:
Ilya Kirillov
2019-07-30 12:58:03 +03:00
parent 46ff959415
commit 0d42d3f0a1
@@ -128,7 +128,8 @@ fun KtElement.processInternalReferencesToUpdateOnPackageNameChange(
if (descriptor.isCompanionObject()
&& bindingContext[BindingContext.SHORT_REFERENCE_TO_COMPANION_OBJECT, refExpr] != null
) {
result = (result as KtObjectDeclaration).containingClassOrObject ?: result
if (result !is KtObjectDeclaration) return@lazy null
result = result.containingClassOrObject ?: result
}
result