Files
kotlin-fork/compiler/testData/codegen/box/nullCheckOptimization/exclExclThrowsNpe.kt
T
2020-01-24 11:56:28 +01:00

14 lines
341 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
fun box(): String {
val s: String? = null
try {
s!!
return "Fail: NPE should have been thrown"
} catch (e: Throwable) {
if (e::class != NullPointerException::class) return "Fail: exception class should be NPE: ${e::class}"
return "OK"
}
}