KT-13941 related: "Simplify using destructuring declaration" is now applicable for function literals without parameter specification

This commit is contained in:
Mikhail Glukhikh
2016-10-03 14:36:25 +03:00
parent df0cf3da84
commit 48437d5965
7 changed files with 121 additions and 27 deletions
@@ -0,0 +1,7 @@
// IS_APPLICABLE: false
data class XY(val x: String, val y: String)
fun convert(xy: XY, foo: (XY) -> String) = foo(xy)
fun foo(xy: XY) = convert<caret>(xy) { it.x + it.y }
@@ -0,0 +1,5 @@
data class XY(val x: String, val y: String)
fun convert(xy: XY, foo: (XY) -> String) = foo(xy)
fun foo(xy: XY) = convert(xy) <caret>{ it.x + it.y }
@@ -0,0 +1,5 @@
data class XY(val x: String, val y: String)
fun convert(xy: XY, foo: (XY) -> String) = foo(xy)
fun foo(xy: XY) = convert(xy) { (x, y) -> x + y }
@@ -0,0 +1,11 @@
// WITH_RUNTIME
data class XY(val x: String, val y: String)
fun convert(xy: XY, foo: (XY) -> Unit) = foo(xy)
fun foo(xy: XY) = convert(xy) <caret>{
val x = it.x
val y = it.y
println(x + y)
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
data class XY(val x: String, val y: String)
fun convert(xy: XY, foo: (XY) -> Unit) = foo(xy)
fun foo(xy: XY) = convert(xy) {
(x, y) ->
println(x + y)
}