While working through the koans, I encountered a problem where using a property reference functioned differently than a full lambda implementation.
Example:
val list = listOf("a", "aa", "b", "ccc")
// result will be a map with a entry.
// key (from my debug session) is
// {_24_ExtensionsOnCollectionsKt$doSomethingStrangeWithCollection$g1$1$1@706}"property length (Kotlin reflection not available"
// Value will be a list of all four strings
val g1 = list.groupBy{ String::length }
// This result is exactly what you would expect
val g2 = list.groupBy{ it.length }
FYI this is with Kotlin 1.0.4-release-ij2016.1-112
So what’s going on here? Why does a using String::length behave differently than it.length? What a I missing?