Files
kotlin-fork/compiler/testData/codegen/box/properties/lateinit/local/uninitializedRead.kt
T
2019-11-19 11:00:09 +03:00

20 lines
418 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
import kotlin.UninitializedPropertyAccessException
fun box(): String {
lateinit var str: String
var str2: String = ""
try {
str2 = str
return "Should throw an exception"
}
catch (e: UninitializedPropertyAccessException) {
return "OK"
}
catch (e: Throwable) {
return "Unexpected exception: ${e::class}"
}
}