Files
kotlin-fork/compiler/testData/codegen/box/nullCheckOptimization/exclExclThrowsKnpe_1_3.kt
T

15 lines
361 B
Kotlin
Vendored

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