98aecbef6b
Instead of generating overrides for getOwner/getName/getSignature in each anonymous class representing a callable reference, pass them to the superclass' constructor and store as fields. This occupies some small memory but helps to reduce the size of the generated class files, and will be helpful for adding further runtime information to callable references, such as information about implicit conversions this reference has been subject to. Represent owner as java.lang.Class + boolean instead of KDeclarationContainer, so that the unnecessary wrapping Class->KClass wouldn't happen before it's needed, and also to make sure all callable references remain serializable. Note that the argument type where the "is declaration container a class" is passed is int instead of boolean. The plan is to pass the aforementioned implicit conversion information as bits of this same integer value. #KT-27362 Fixed
20 lines
551 B
Kotlin
Vendored
20 lines
551 B
Kotlin
Vendored
// !API_VERSION: 1.3
|
|
// IGNORE_BACKEND_FIR: JVM_IR
|
|
|
|
// This test simply checks that we still generate correct calls to PropertyReference1Impl constructors for API version < 1.4,
|
|
// where we added and started using new constructors which take j.l.Class+int instead of KDeclarationContainer.
|
|
|
|
class D(val v: String) {
|
|
operator fun getValue(a: Any?, b: Any?): String = v
|
|
operator fun setValue(a: Any?, b: Any?, c: String) {}
|
|
}
|
|
|
|
class A {
|
|
val o by D("O")
|
|
var k by D("K")
|
|
val z by D("")
|
|
}
|
|
|
|
fun box(): String =
|
|
A().o + A().k + A().z
|