[FIR][CFG] Partial support of postponed Nothing calls

In try blocks, last call won't be completed when building node for it
This is workaround to partially reconstruct nothing stub node for such
calls. Should work for non-local returns in try only.
#KT-48160 Fixed
This commit is contained in:
Andrey Zinovyev
2021-08-10 13:59:54 +03:00
committed by TeamCityServer
parent 445e5122c1
commit 3ec9599bc4
7 changed files with 98 additions and 2 deletions
@@ -0,0 +1,24 @@
//KT-48160
// FIR_IDENTICAL
// FULL_JDK
// WITH_STDLIB
import java.io.File
inline fun <T : AutoCloseable, R> T.use(block: (T) -> R): R {
return block(this)
}
fun foo(): Int? {
try {
File("123").bufferedWriter().use {
return 45
}
} catch (e: Exception) {
if (e.message?.startsWith("Remote does not have ") == true) {
return null
}
return null
}
}
@@ -0,0 +1,4 @@
package
public fun foo(): kotlin.Int?
public inline fun </*0*/ T : java.lang.AutoCloseable, /*1*/ R> T.use(/*0*/ block: (T) -> R): R