Files
kotlin-fork/compiler/testData/codegen/box/nullCheckOptimization/exclExclThrowsNpe_1_4.kt
T
2019-09-16 12:33:01 +02:00

14 lines
335 B
Kotlin
Vendored

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