JVM IR: fix smart cast on argument of 'throw'
#KT-48163 Fixed
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
// 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!!
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
|
||||
fun f(x: Throwable) { throw x }
|
||||
fun f(x: Exception) { throw x }
|
||||
fun f(x: RuntimeException) { throw x }
|
||||
fun f(x: Error) { throw x }
|
||||
fun f(x: AssertionError) { throw x }
|
||||
|
||||
// 0 CHECKCAST
|
||||
Reference in New Issue
Block a user