Files
kotlin-fork/compiler/testData/codegen/box/properties/lateinit/local/uninitializedRead.kt
T
2020-04-07 14:06:38 +03:00

19 lines
388 B
Kotlin
Vendored

// 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}"
}
}