Files
kotlin-fork/compiler/testData/codegen/box/nullCheckOptimization/exclExclThrowsKnpe_1_3.kt
T
2020-04-02 12:42:50 +03:00

15 lines
356 B
Kotlin
Vendored

// !API_VERSION: 1.3
// 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"
}
}