Files
kotlin-fork/compiler/testData/codegen/box/properties/lateinit/accessorException.kt
T
2021-09-08 19:56:38 +03:00

34 lines
709 B
Kotlin
Vendored

public class A {
fun getFromClass(): Boolean {
try {
val a = str
return false
} catch (e: RuntimeException) {
return true
}
}
fun getFromCompanion() = Companion.getFromCompanion()
private companion object {
private lateinit var str: String
fun getFromCompanion(): Boolean {
try {
val a = str
return false
} catch (e: RuntimeException) {
return true
}
}
}
}
fun box(): String {
if (!A().getFromClass()) return "Fail getFromClass"
if (!A().getFromCompanion()) return "Fail getFromCompanion"
return "OK"
}