[IR][tests] Add tests for removal-of-abstract-fun IR linkage case

^KT-50771
This commit is contained in:
Dmitriy Dolovov
2022-04-25 14:55:36 +03:00
parent df909abaf5
commit 8e8ecc48ad
38 changed files with 320 additions and 0 deletions
@@ -0,0 +1,5 @@
package lib1
abstract class A {
abstract fun foo(): Int
}
@@ -0,0 +1,3 @@
package lib1
open class A
@@ -0,0 +1,12 @@
STEP 0:
dependencies: stdlib
modifications:
U : l1.kt.0 -> l1.kt
STEP 1:
dependencies: stdlib
modifications:
U : l1.kt.1 -> l1.kt
STEP 2:
dependencies: stdlib
modifications:
U : l1.kt.0 -> l1.kt
@@ -0,0 +1,7 @@
package lib2
import lib1.A
class B : A() {
override fun foo() = 42
}
@@ -0,0 +1,5 @@
package lib2
import lib1.A
class B : A()
@@ -0,0 +1,6 @@
STEP 0:
dependencies: stdlib, lib1
STEP 1:
dependencies: stdlib, lib1
modifications:
U : l2.kt.1 -> l2.kt
@@ -0,0 +1,19 @@
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(".")}"
@@ -0,0 +1,2 @@
STEP 0:
dependencies: stdlib, lib1, lib2
@@ -0,0 +1,10 @@
MODULES: lib1, lib2, main
STEP 0:
libs: lib1, lib2, main
STEP 1:
libs: lib1, lib2
STEP 2:
libs: lib1