Files
kotlin-fork/compiler/testData/codegen/box/smartCasts/kt48163_smartCastToThrowable.kt
T
Alexander Udalov afacff326d JVM IR: fix smart cast on argument of 'throw'
#KT-48163 Fixed
2021-08-09 22:34:44 +02:00

20 lines
302 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
import java.io.Serializable
fun bar(s: Serializable) {
when (s) {
is Exception -> throw s
else -> Unit
}
}
fun box(): String {
try {
bar(Exception("OK"))
return "Fail"
} catch (e: Exception) {
return e.message!!
}
}