KT-7929 related: KtDestructuringDeclarationEntry is not resolved to descriptor in OverridingDeprecatedMemberInspection
This commit is contained in:
+2
-4
@@ -22,10 +22,7 @@ import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiElementVisitor
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptor
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtNamedDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtPropertyAccessor
|
||||
import org.jetbrains.kotlin.psi.KtVisitorVoid
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.deprecatedByOverriddenMessage
|
||||
import org.jetbrains.kotlin.resolve.getDeprecation
|
||||
|
||||
@@ -41,6 +38,7 @@ class OverridingDeprecatedMemberInspection : AbstractKotlinInspection() {
|
||||
}
|
||||
|
||||
private fun registerProblemIfNeeded(declaration: KtDeclaration, targetForProblem: PsiElement) {
|
||||
if (declaration is KtDestructuringDeclarationEntry) return
|
||||
val accessorDescriptor = declaration.resolveToDescriptor() as? CallableMemberDescriptor ?: return
|
||||
|
||||
val message = accessorDescriptor.getDeprecation()?.deprecatedByOverriddenMessage() ?: return
|
||||
|
||||
@@ -44,4 +44,10 @@ interface Explicit : I {
|
||||
@Deprecated("a")
|
||||
override fun f(): Int {
|
||||
}
|
||||
}
|
||||
|
||||
data class Pair(x: Int, y: Int)
|
||||
|
||||
class Exc {
|
||||
val (a, b) = Pair(1, 2)
|
||||
}
|
||||
Reference in New Issue
Block a user