Files
kotlin-fork/compiler/testData/ir/interpreter/exceptions/stackTrace.kt
T
2021-06-07 15:35:12 +03:00

28 lines
971 B
Kotlin
Vendored

@CompileTimeCalculation
fun divide(a: Int, b: Int) = a / b
@CompileTimeCalculation
fun echo(a : Int, b: Int) = divide(a, b)
@CompileTimeCalculation
fun getLengthOrThrowException(str: String?): Int {
try {
return str!!.length
} catch (e: NullPointerException) {
throw UnsupportedOperationException(e)
}
}
const val a = <!WAS_NOT_EVALUATED: `
Exception java.lang.ArithmeticException: / by zero
at StackTraceKt.divide(stackTrace.kt:2)
at StackTraceKt.echo(stackTrace.kt:5)
at StackTraceKt.<clinit>(stackTrace.kt:16)`!>echo(1, 0)<!>
const val b = <!WAS_NOT_EVALUATED: `
Exception java.lang.UnsupportedOperationException: java.lang.NullPointerException
at StackTraceKt.getLengthOrThrowException(stackTrace.kt:12)
at StackTraceKt.<clinit>(stackTrace.kt:17)
Caused by: java.lang.NullPointerException
at StackTraceKt.getLengthOrThrowException(stackTrace.kt:10)
at StackTraceKt.<clinit>(stackTrace.kt:17)`!>getLengthOrThrowException(null)<!>