https://kotlinlang.org logo
#codereview
Title
# codereview
c

christophsturm

03/11/2021, 9:29 AM
if i have a method that takes a kproperty1 for one specific class, why does the kotlin compiler not allow to omit the class name when calling it?
Copy code
data class Recipe(val id: Long?, val name: String, val description: String?) {
    companion object {
        fun find(field: KProperty1<Recipe, *>) {}
    }
}
this works:
Copy code
Recipe.find(field = Recipe::id)
and this is red:
Copy code
Recipe.find(field = ::id)
or somehow related the same for functions.
Copy code
listOf("aaa", "bbb").map(String::toLowerCase)
u

uli

03/11/2021, 11:16 AM
Try #language-proposals #language-evolution
c

christophsturm

03/11/2021, 11:18 AM
thanks!