[NI] Improve inference for lambdas that return lambdas
This commit is contained in:
+22
@@ -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()
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package
|
||||
|
||||
public inline fun </*0*/ R> myRun(/*0*/ block: () -> R): R
|
||||
public fun testLambda(): kotlin.Unit
|
||||
Reference in New Issue
Block a user