Native: RedundantCoercionsCleaner should rewrite nested returns too

This commit is contained in:
Svyatoslav Scherbina
2021-08-25 16:19:41 +03:00
committed by Space
parent 3176dd1341
commit 981a6ffeb8
3 changed files with 23 additions and 1 deletions
@@ -0,0 +1,17 @@
package codegen.inline.redundantCoercionsCleaner
import kotlin.test.*
inline fun runAndThrow(action: () -> Unit): Nothing {
action()
throw Exception()
}
inline fun foo(): Int = runAndThrow {
return 1
}
@Test fun runTest() {
val result: Any = foo()
assertEquals(1, result)
}