[JS IR] Add IC test for interface with default implementation

This commit is contained in:
Alexander Korepanov
2023-05-01 10:53:03 +02:00
committed by Space Team
parent 180613e1c6
commit 9da9c95105
18 changed files with 119 additions and 0 deletions
@@ -0,0 +1,3 @@
interface A {
fun testA1() = 1
}
@@ -0,0 +1,5 @@
interface A {
fun testA1() = 2
fun testA2() = 1
}
@@ -0,0 +1,3 @@
interface B : A {
fun testB1() = 2
}
@@ -0,0 +1,3 @@
interface C : B {
fun testC1() = 3
}
@@ -0,0 +1,14 @@
STEP 0:
modifications:
U : InterfaceA.0.kt -> InterfaceA.kt
U : InterfaceB.0.kt -> InterfaceB.kt
U : InterfaceC.0.kt -> InterfaceC.kt
added file: InterfaceA.kt, InterfaceB.kt, InterfaceC.kt
STEP 1:
modifications:
U : InterfaceA.1.kt -> InterfaceA.kt
modified ir: InterfaceA.kt
updated exports: InterfaceA.kt
updated imports: InterfaceB.kt, InterfaceC.kt
STEP 2:
updated exports: InterfaceB.kt, InterfaceC.kt
@@ -0,0 +1,3 @@
fun getObjectA() : A {
return myObject
}
@@ -0,0 +1,3 @@
fun getObjectB() : B {
return myObject
}
@@ -0,0 +1,3 @@
fun getObjectC() : C {
return myObject
}
@@ -0,0 +1,4 @@
private class MyClass : C {
}
internal val myObject: C = MyClass()
@@ -0,0 +1,8 @@
STEP 0:
dependencies: lib1
added file: GetA.kt, GetB.kt, GetC.kt, MyClass.kt
STEP 1:
dependencies: lib1
updated imports: MyClass.kt, GetB.kt, GetC.kt, GetA.kt
STEP 2:
dependencies: lib1
@@ -0,0 +1,15 @@
fun box(stepId: Int): String {
val expected = when (stepId) {
0 -> 10
1 -> 13
2 -> 16
else -> return "Unknown"
}
val x = test()
if (expected != x) {
return "Fail $expected != $x"
}
return "OK"
}
@@ -0,0 +1,13 @@
STEP 0:
dependencies: lib1, lib2
modifications:
U : test.0.kt -> test.kt
added file: m.kt, test.kt
STEP 1:
dependencies: lib1, lib2
updated imports: test.kt
STEP 2:
dependencies: lib1, lib2
modifications:
U : test.2.kt -> test.kt
modified ir: test.kt
@@ -0,0 +1,7 @@
fun test(): Int {
val a = getObjectA()
val b = getObjectB()
val c = getObjectC()
return a.testA1() + b.testA1() + b.testB1() + c.testA1() + c.testB1() + c.testC1()
}
@@ -0,0 +1,9 @@
fun test(): Int {
val a = getObjectA()
val b = getObjectB()
val c = getObjectC()
return a.testA1() + a.testA2() +
b.testA1() + b.testA2() + b.testB1() +
c.testA1() + c.testA2() + c.testB1() + c.testC1()
}
@@ -0,0 +1,8 @@
MODULES: lib1, lib2, main
STEP 0..1:
libs: lib1, lib2, main
dirty js: lib1, lib2, main
STEP 2:
libs: lib1, lib2, main
dirty js: lib1, main