KT-14513 Don't generate delegated property metadata when unused

If the delegated property operators involved are inline, and delegated
property metadata parameter is not used (which is often the case, e.g.,
'lazy'), we can skip those properties in metadata generation.

NOT implemented: special case when only 'kProperty.name' is used by the
corresponding delegated property operators.

Also a sneak fix for KT-34060.
This commit is contained in:
Dmitry Petrov
2019-09-27 14:24:11 +03:00
committed by Dmitry Petrov
parent 92ba298e68
commit a633a33627
29 changed files with 1054 additions and 25 deletions
+12 -3
View File
@@ -16,13 +16,22 @@ fun f(a: Int, b: Int, <!UNUSED_PARAMETER!>c<!>: Int = b) {
a + a
}
fun Any.getValue(thisRef: Any?, prop: KProperty<*>): String = ":)"
fun Any.setValue(thisRef: Any?, prop: KProperty<*>, value: String) {
fun Any.getValue(<!UNUSED_PARAMETER!>thisRef<!>: Any?, <!UNUSED_PARAMETER!>prop<!>: KProperty<*>): String = ":)"
fun Any.setValue(<!UNUSED_PARAMETER!>thisRef<!>: Any?, <!UNUSED_PARAMETER!>prop<!>: KProperty<*>, <!UNUSED_PARAMETER!>value<!>: String) {
}
fun Any.provideDelegate(thisRef: Any?, prop: KProperty<*>) {
fun Any.provideDelegate(<!UNUSED_PARAMETER!>thisRef<!>: Any?, <!UNUSED_PARAMETER!>prop<!>: KProperty<*>) {
}
operator fun Int.getValue(thisRef: Any?, prop: KProperty<*>): String = ":)"
operator fun Int.setValue(thisRef: Any?, prop: KProperty<*>, value: String) {
}
operator fun Int.provideDelegate(thisRef: Any?, prop: KProperty<*>) {
}
fun get(<!UNUSED_PARAMETER!>p<!>: Any) {
}