Is it possible for me to create a function that would look something like this?
jeggy
08/02/2021, 9:27 PM
Copy code
interface A { val field: Int }
data class B(override val field: Int): A
fun <T: A> myFunction(property: KProperty1<T, Int>? = null) {
val kProperty = (property ?: A::field) as KProperty1<Any, Int>
/* Something */
}
fun main() {
myFunction(B::field)
}