Handle constructor usage for actual class as usage of expect class

#KT-25498 Fixed
This commit is contained in:
Mikhail Glukhikh
2018-08-08 15:31:43 +03:00
parent f4d048334f
commit 0fb8dd2f75
8 changed files with 34 additions and 3 deletions
@@ -181,10 +181,13 @@ fun KtSimpleNameReference.canBePsiMethodReference(): Boolean {
}
private fun PsiElement.isConstructorOf(unwrappedCandidate: PsiElement) =
// call to Java constructor
(this is PsiMethod && isConstructor && containingClass == unwrappedCandidate) ||
when {
// call to Java constructor
this is PsiMethod && isConstructor && containingClass == unwrappedCandidate -> true
// call to Kotlin constructor
(this is KtConstructor<*> && getContainingClassOrObject() == unwrappedCandidate)
this is KtConstructor<*> && getContainingClassOrObject().isEquivalentTo(unwrappedCandidate) -> true
else -> false
}
fun AbstractKtReference<out KtExpression>.renameImplicitConventionalCall(newName: String?): KtExpression {
if (newName == null) return expression