Introduce inspection detecting self-assignment of properties
So #KT-20714 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
ffa9478d0c
commit
204d9e3423
@@ -0,0 +1,20 @@
|
||||
// PROBLEM: none
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.properties.ReadWriteProperty
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Test {
|
||||
var foo: Int by Delegate()
|
||||
|
||||
fun test() {
|
||||
foo = <caret>foo
|
||||
}
|
||||
}
|
||||
|
||||
class Delegate : ReadWriteProperty<Test, Int> {
|
||||
override fun getValue(thisRef: Test, property: KProperty<*>): Int = 1
|
||||
override fun setValue(thisRef: Test, property: KProperty<*>, value: Int) {
|
||||
println()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user