Files
kotlin-fork/compiler/testData/codegen/box/properties/lateinit/local/uninitializedRead.kt
T
2018-11-01 16:51:43 +03:00

19 lines
412 B
Kotlin
Vendored

// LANGUAGE_VERSION: 1.2
// 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}"
}
}