21 lines
614 B
Kotlin
Vendored
21 lines
614 B
Kotlin
Vendored
fun box(): String {
|
|
return try {
|
|
bar()
|
|
"FAIL"
|
|
} catch (e: Throwable) {
|
|
e.checkLinkageError("constructor Foo.<init> can not be called")
|
|
}
|
|
}
|
|
|
|
private fun Throwable.checkLinkageError(prefix: String): String {
|
|
if (this::class.simpleName != "IrLinkageError") return "Unexpected throwable: ${this::class}"
|
|
|
|
val expectedMessagePrefix = "$prefix because it uses unlinked symbols"
|
|
val actualMessage = message.orEmpty()
|
|
|
|
return if (actualMessage.startsWith(expectedMessagePrefix))
|
|
"OK"
|
|
else
|
|
"EXPECTED: $expectedMessagePrefix, ACTUAL: $actualMessage"
|
|
}
|