Files
kotlin-fork/compiler/testData/klibABI/removeAbstractFunctionFromAbstractClass/main/m.kt
T
2022-05-18 18:04:26 +03:00

20 lines
542 B
Kotlin
Vendored

import lib1.A
import lib2.B
fun box(): String {
val a: A = B()
try {
val answer: Int = a.foo() // <-- should throw linkage error here
println(answer)
} catch (e: Throwable) {
if (e.isLinkageError("lib2.B.foo")) return "OK"
}
return "FAIL"
}
private fun Throwable.isLinkageError(symbolName: String): Boolean =
this::class.simpleName == "IrLinkageError"
&& message == "Abstract function $symbolName is not implemented in non-abstract class ${symbolName.substringBeforeLast(".")}"