[NI] Improve inference for lambdas that return lambdas

This commit is contained in:
Mikhail Zarechenskiy
2018-01-11 10:58:08 +03:00
parent b8c0910724
commit 4ed5e2f35e
12 changed files with 207 additions and 143 deletions
@@ -0,0 +1,22 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
fun testLambda() {
val basicTest: (Int) -> Int = myRun {
val x: Any? = null
if (x is String) return@myRun { it -> <!DEBUG_INFO_SMARTCAST!>x<!>.length + it }
if (x !is Int) return@myRun { it -> it }
{ it -> <!DEBUG_INFO_SMARTCAST!>x<!> + it }
}
val twoLambda: (Int) -> Int = myRun {
val x: Int = 1
run {
val y: Int = 2
{ x + y }
}
}
}
inline fun <R> myRun(block: () -> R): R = block()
@@ -0,0 +1,4 @@
package
public inline fun </*0*/ R> myRun(/*0*/ block: () -> R): R
public fun testLambda(): kotlin.Unit