Convert lambda to reference intention: apply shorten references to callable reference only, not to the whole argument list

This commit is contained in:
Mikhail Glukhikh
2016-09-08 20:01:02 +03:00
parent 06b7881776
commit 23132ad519
4 changed files with 19 additions and 1 deletions
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun bar(s: String) = s.length
val x = listOf("Jack", "Tom").mapTo(kotlin.collections.hashSetOf<Int>()) <caret>{ w -> bar(w) }
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun bar(s: String) = s.length
val x = listOf("Jack", "Tom").mapTo(kotlin.collections.hashSetOf<Int>(), ::bar)