[JS IR IC] Interface default implementations affect IC hash

Adding or removing a method or property with
a default implementation to an interface should
invalidate all children: we must regenerate JS code for them

^KT-56237 Fixed
This commit is contained in:
Alexander Korepanov
2023-04-25 14:53:34 +02:00
committed by Space Team
parent bad5c58952
commit 81b591ed21
45 changed files with 391 additions and 70 deletions
@@ -0,0 +1,6 @@
class ClassA {
fun leakObject(): Interface {
val obj = object : Interface {}
return obj
}
}
@@ -0,0 +1,8 @@
class ClassA {
fun leakObject(): Interface {
val obj = object : Interface {
override fun getNumber() = 1
}
return obj
}
}
@@ -0,0 +1,5 @@
interface Interface {
val extraNumber get() = 0
fun getNumber() = 0
}
@@ -0,0 +1,7 @@
interface Interface {
val extraNumber get() = 1
fun getNumber() = 0
fun getOtherNumber() = 1
}
@@ -0,0 +1,9 @@
interface Interface {
val extraNumber get() = 2
fun getNumber() = 0
fun getOtherNumber() = 1
val otherExtraNumber get() = 1
}
@@ -0,0 +1,24 @@
STEP 0:
modifications:
U : classA.0.kt -> classA.kt
U : interface.0.kt -> interface.kt
added file: classA.kt, interface.kt
STEP 1:
modifications:
U : classA.1.kt -> classA.kt
modified ir: classA.kt
STEP 2:
modifications:
U : interface.2.kt -> interface.kt
modified ir: interface.kt
updated exports: interface.kt
updated imports: classA.kt
STEP 3:
STEP 4:
modifications:
U : interface.4.kt -> interface.kt
modified ir: interface.kt
updated exports: interface.kt
updated imports: classA.kt
STEP 5:
updated exports: interface.kt
@@ -0,0 +1,7 @@
fun box(stepId: Int): String {
val x = test()
if (x != stepId) {
return "Fail $x != $stepId"
}
return "OK"
}
@@ -0,0 +1,23 @@
STEP 0:
dependencies: lib1
modifications:
U : test.0.kt -> test.kt
added file: m.kt, test.kt
STEP 1:
dependencies: lib1
STEP 2:
dependencies: lib1
updated imports: test.kt
STEP 3:
dependencies: lib1
modifications:
U : test.3.kt -> test.kt
modified ir: test.kt
STEP 4:
dependencies: lib1
updated imports: test.kt
STEP 5:
dependencies: lib1
modifications:
U : test.5.kt -> test.kt
modified ir: test.kt
@@ -0,0 +1,5 @@
fun test(): Int {
val a = ClassA()
val obj = a.leakObject()
return obj.getNumber() + obj.extraNumber
}
@@ -0,0 +1,5 @@
fun test(): Int {
val a = ClassA()
val obj = a.leakObject()
return obj.getNumber() + obj.extraNumber + obj.getOtherNumber()
}
@@ -0,0 +1,5 @@
fun test(): Int {
val a = ClassA()
val obj = a.leakObject()
return obj.getNumber() + obj.extraNumber + obj.getOtherNumber() + obj.otherExtraNumber
}
@@ -0,0 +1,17 @@
MODULES: lib1, main
STEP 0:
libs: lib1, main
dirty js: lib1, main
STEP 1:
libs: lib1, main
dirty js: lib1
STEP 2:
libs: lib1, main
dirty js: lib1, main
STEP 3:
libs: lib1, main
dirty js: main
STEP 4..5:
libs: lib1, main
dirty js: lib1, main