Can be parameter inspection: use in selector position is now always handled as "property use"
This commit is contained in:
committed by
Mikhail Glukhikh
parent
795b92461e
commit
64ae9af3a4
@@ -41,10 +41,10 @@ class CanBeParameterInspection : AbstractKotlinInspection() {
|
|||||||
private fun PsiReference.usedAsPropertyIn(klass: KtClass): Boolean {
|
private fun PsiReference.usedAsPropertyIn(klass: KtClass): Boolean {
|
||||||
if (this !is KtSimpleNameReference) return true
|
if (this !is KtSimpleNameReference) return true
|
||||||
val nameExpression = element
|
val nameExpression = element
|
||||||
// this.x
|
// receiver.x
|
||||||
val parent = element.parent
|
val parent = element.parent
|
||||||
if (parent is KtQualifiedExpression) {
|
if (parent is KtQualifiedExpression) {
|
||||||
if (parent.receiverExpression is KtThisExpression) return true
|
if (parent.selectorExpression == element) return true
|
||||||
}
|
}
|
||||||
// x += something
|
// x += something
|
||||||
if (parent is KtBinaryExpression &&
|
if (parent is KtBinaryExpression &&
|
||||||
|
|||||||
@@ -116,4 +116,8 @@ class UsedInDelegate(val x: Int) {
|
|||||||
val y: Int by lazy {
|
val y: Int by lazy {
|
||||||
x * x
|
x * x
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// NO
|
||||||
|
class UsedInParent(val x: UsedInParent?) {
|
||||||
|
val y = x?.x
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user