Inliner: specify explicit lambda signature for calls with lambdas

So #KT-17213 Fixed
So #KT-17395 Fixed
This commit is contained in:
Mikhail Glukhikh
2017-04-04 15:38:14 +03:00
parent 02e9a3d027
commit f8e1f5e613
10 changed files with 102 additions and 6 deletions
@@ -0,0 +1,7 @@
class Declaration {
fun lambdaType(p: Int, f: (Int) -> Int) = f(p)
}
fun call(declaration: Declaration) {
declaration.<caret>lambdaType(6) { it + 7 }
}
@@ -0,0 +1,6 @@
class Declaration {
}
fun call(declaration: Declaration) {
({ it: Int -> it + 7 })(6)
}
@@ -0,0 +1,6 @@
class Declaration {
fun lambdaType(p: Int, f: (Int) -> Int) = f(p)
}
fun call(declaration: Declaration) {
declaration.<caret>lambdaType(8) { x -> x + 9 }}
@@ -0,0 +1,6 @@
class Declaration {
}
fun call(declaration: Declaration) {
({ x: Int -> x + 9 })(8)
}
@@ -0,0 +1,7 @@
class Declaration {
fun lambdaType(p: Int, f: (Int) -> Int) = f(p)
}
fun call(declaration: Declaration) {
declaration.<caret>lambdaType(10) { _ -> 11 }
}
@@ -0,0 +1,6 @@
class Declaration {
}
fun call(declaration: Declaration) {
({ _: Int -> 11 })(10)
}
@@ -0,0 +1,4 @@
fun <T, U> operateLambda(p: T, f: (T) -> U) = f(p)
fun returnLabel() {
<caret>operateLambda(1) {}
}
@@ -0,0 +1,3 @@
fun returnLabel() {
({ it: Int -> })(1)
}