[FE 1.0] Don't report UNUSED_* warnings on local properties with delegate

^KT-25527 Fixed
This commit is contained in:
Dmitriy Novozhilov
2022-05-13 11:39:13 +03:00
committed by teamcity
parent 4d5a4ccd6b
commit 89b1307e16
8 changed files with 127 additions and 2 deletions
@@ -0,0 +1,40 @@
// ISSUE: KT-25527
import kotlin.reflect.KProperty
fun test_1(delegate: Delegate) {
var p1 by delegate
p1 = 10
var p2 by delegate
<!UNUSED_CHANGED_VALUE!>p2++<!>
var p3 by delegate
++p3
}
fun test_2() {
var <!ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE!>p1<!> = 0
<!UNUSED_VALUE!>p1 =<!> 10
var <!ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE!>p2<!>: Int
<!UNUSED_VALUE!>p2 =<!> 10
var p3 = 1
<!UNUSED_CHANGED_VALUE!>p3++<!>
var p4 = 1
++p4
}
class Delegate {
var prop: Int = 0
operator fun getValue(thisRef: Any?, property: KProperty<*>): Int {
return prop
}
operator fun setValue(thisRef: Any?, property: KProperty<*>, value: Int) {
prop = value
}
}