[NI] Finish analysis for coerced last lambda expressions if needed

This commit is contained in:
Mikhail Zarechenskiy
2020-02-11 09:02:31 +03:00
parent 220bf6d62f
commit 4542f3b720
34 changed files with 145 additions and 55 deletions
@@ -0,0 +1,35 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun <T> myRun(action: () -> T): T = action()
fun foo(): String = "foo"
fun <K> materialize(): K {
result += "K"
return "str" as K
}
var result = "fail"
fun test1(n: Number, b: Boolean) {
n.let {
if (b) return@let
myRun {
result = "O"
foo()
}
}
}
fun test2(n: Number, b: Boolean) {
n.let {
if (b) return@let
materialize()
}
}
fun box(): String {
test1(42, false)
test2(42, false)
return result
}