Files
kotlin-fork/compiler/testData/codegen/box/reflection/lambdaClasses/reflectOnLambdaInConstructor.kt
T
Alexander Udalov fc36178f3a Annotate kotlin.reflect.jvm.reflect with ExperimentalReflectionOnLambdas
This function was always experimental, as explained in its kdoc, but it
was introduced before opt-in requirement markers were supported. Thus,
breaking changes (such as in KT-42746) were always expected, and the
`@ExperimentalReflectionOnLambdas` annotation just makes it clearer.

 #KT-45486 Fixed
2021-03-15 15:54:31 +01:00

18 lines
436 B
Kotlin
Vendored

// !USE_EXPERIMENTAL: kotlin.reflect.jvm.ExperimentalReflectionOnLambdas
// TARGET_BACKEND: JVM
// WITH_REFLECT
import kotlin.reflect.jvm.reflect
class C {
val o = { O: String -> }
val k = { K: String -> }
constructor(y: Int)
constructor(y: String)
}
fun box(): String =
(C(0).o.reflect()?.parameters?.singleOrNull()?.name ?: "null") +
(C("").k.reflect()?.parameters?.singleOrNull()?.name ?: "null")