mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-16 08:31:35 +00:00
Introduce MetadataSource as a way to store the original descriptor for any element (before any lowerings) and maintain it until the end of the codegen where it's used in generating the metadata. Note that JVM signatures written to the metadata are formed from the _resulting_ generated elements, not by mapping the original descriptors. Some corner cases are not supported yet, namely properties declared in companion objects, synthetic methods for property annotations, JvmPackageName, etc. #KT-29119 Fixed
28 lines
717 B
Kotlin
Vendored
28 lines
717 B
Kotlin
Vendored
// IGNORE_BACKEND: JS_IR
|
|
// TODO: muted automatically, investigate should it be ran for JS or not
|
|
// IGNORE_BACKEND: JS, NATIVE
|
|
|
|
// WITH_REFLECT
|
|
|
|
import kotlin.reflect.full.*
|
|
|
|
class A(param: String) {
|
|
val int: Int get() = 42
|
|
val string: String = param
|
|
var anyVar: Any? = null
|
|
|
|
val List<IntRange>.extensionToList: Unit get() {}
|
|
|
|
fun notAProperty() {}
|
|
}
|
|
|
|
fun box(): String {
|
|
val props = A::class.memberProperties
|
|
|
|
val names = props.map { it.name }.sorted()
|
|
assert(names == listOf("anyVar", "int", "string")) { "Fail names: $props" }
|
|
|
|
val stringProp = props.firstOrNull { it.name == "string" } ?: return "Fail, string not found: $props"
|
|
return stringProp.get(A("OK")) as String
|
|
}
|