Don't report "Redundant Companion reference" on accessing nested object
So #KT-23620 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
94c5344fd1
commit
a5aad22fe7
+2
-1
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall
|
||||
import org.jetbrains.kotlin.idea.references.mainReference
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
||||
import org.jetbrains.kotlin.resolve.calls.util.FakeCallableDescriptorForObject
|
||||
|
||||
class RedundantCompanionReferenceInspection : AbstractKotlinInspection() {
|
||||
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {
|
||||
@@ -31,7 +32,7 @@ class RedundantCompanionReferenceInspection : AbstractKotlinInspection() {
|
||||
val grandParent = parent.parent as? KtQualifiedExpression
|
||||
if (grandParent != null) {
|
||||
val grandParentDescriptor = grandParent.resolveToCall()?.resultingDescriptor ?: return
|
||||
if (grandParentDescriptor is ConstructorDescriptor) return
|
||||
if (grandParentDescriptor is ConstructorDescriptor || grandParentDescriptor is FakeCallableDescriptorForObject) return
|
||||
}
|
||||
|
||||
holder.registerProblem(
|
||||
|
||||
Reference in New Issue
Block a user