[FE 1.0] Don't report UNUSED_* warnings on local properties with delegate
^KT-25527 Fixed
This commit is contained in:
committed by
teamcity
parent
4d5a4ccd6b
commit
89b1307e16
Vendored
+40
@@ -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
|
||||
p2++
|
||||
|
||||
var p3 by delegate
|
||||
++p3
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
var p1 = 0
|
||||
p1 = 10
|
||||
|
||||
var p2: Int
|
||||
p2 = 10
|
||||
|
||||
var p3 = 1
|
||||
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
|
||||
}
|
||||
}
|
||||
Vendored
+40
@@ -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
|
||||
}
|
||||
}
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
package
|
||||
|
||||
public fun test_1(/*0*/ delegate: Delegate): kotlin.Unit
|
||||
public fun test_2(): kotlin.Unit
|
||||
|
||||
public final class Delegate {
|
||||
public constructor Delegate()
|
||||
public final var prop: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.reflect.KProperty<*>): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.reflect.KProperty<*>, /*2*/ value: kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user