Files
kotlin-fork/compiler/testData/diagnostics/tests/deprecated/propertyUsage.fir.kt
T
Andrey Zinovyev de3f31cf78 [FIR] Partial implementation of DEPRECATION(_ERROR) diagnostics
No support for inheritance deprecations
and deprecations in qualifier's parts
2021-07-07 16:19:28 +03:00

67 lines
1.5 KiB
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_EXPRESSION
import kotlin.reflect.KProperty
class Delegate() {
@Deprecated("text")
operator fun getValue(instance: Any, property: KProperty<*>) : Int = 1
@Deprecated("text")
operator fun setValue(instance: Any, property: KProperty<*>, value: Int) {}
}
class PropertyHolder {
@Deprecated("text")
val x = 1
@Deprecated("text")
var name = "String"
val valDelegate by Delegate()
var varDelegate by Delegate()
public val test1: String = ""
@Deprecated("val-getter") get
public var test2: String = ""
@Deprecated("var-getter") get
@Deprecated("var-setter") set
public var test3: String = ""
@Deprecated("var-getter") get
set
public var test4: String = ""
get
@Deprecated("var-setter") set
}
fun PropertyHolder.extFunction() {
test2 <!DEPRECATION!>=<!> "ext"
<!DEPRECATION!>test1<!>
}
fun fn() {
PropertyHolder().<!DEPRECATION!>test1<!>
PropertyHolder().<!DEPRECATION!>test2<!>
PropertyHolder().test2 <!DEPRECATION!>=<!> ""
PropertyHolder().<!DEPRECATION!>test3<!>
PropertyHolder().test3 = ""
PropertyHolder().test4
PropertyHolder().test4 <!DEPRECATION!>=<!> ""
val a = PropertyHolder().<!DEPRECATION!>x<!>
val b = PropertyHolder().<!DEPRECATION!>name<!>
PropertyHolder().name <!DEPRECATION!>=<!> "value"
val d = PropertyHolder().valDelegate
PropertyHolder().varDelegate = 1
}
fun literals() {
PropertyHolder::<!DEPRECATION!>test1<!>
PropertyHolder::<!DEPRECATION!>name<!>
}