Can be parameter inspection: use in selector position is now always handled as "property use"

This commit is contained in:
Mikhail Glukhikh
2016-04-25 15:07:03 +03:00
committed by Mikhail Glukhikh
parent 795b92461e
commit 64ae9af3a4
2 changed files with 6 additions and 2 deletions
@@ -41,10 +41,10 @@ class CanBeParameterInspection : AbstractKotlinInspection() {
private fun PsiReference.usedAsPropertyIn(klass: KtClass): Boolean {
if (this !is KtSimpleNameReference) return true
val nameExpression = element
// this.x
// receiver.x
val parent = element.parent
if (parent is KtQualifiedExpression) {
if (parent.receiverExpression is KtThisExpression) return true
if (parent.selectorExpression == element) return true
}
// x += something
if (parent is KtBinaryExpression &&
+4
View File
@@ -116,4 +116,8 @@ class UsedInDelegate(val x: Int) {
val y: Int by lazy {
x * x
}
}
// NO
class UsedInParent(val x: UsedInParent?) {
val y = x?.x
}