[JS IR] Add JS IR IC tests about companion properties modifications

^KT-54479 Test
This commit is contained in:
Alexander Korepanov
2022-10-17 18:23:35 +02:00
committed by Space Team
parent cd87830ffa
commit 901ebcc043
25 changed files with 216 additions and 0 deletions
@@ -70,6 +70,11 @@ public class InvalidationTestGenerated extends AbstractInvalidationTest {
runTest("js/js.translator/testData/incremental/invalidation/companionInlineFunction/");
}
@TestMetadata("companionProperties")
public void testCompanionProperties() throws Exception {
runTest("js/js.translator/testData/incremental/invalidation/companionProperties/");
}
@TestMetadata("companionWithStdLibCall")
public void testCompanionWithStdLibCall() throws Exception {
runTest("js/js.translator/testData/incremental/invalidation/companionWithStdLibCall/");
@@ -0,0 +1,5 @@
class MyClass {
companion object {
val stringProperty = "0"
}
}
@@ -0,0 +1,6 @@
class MyClass {
companion object {
val stringProperty = "0"
val intProperty = 1
}
}
@@ -0,0 +1,6 @@
class MyClass {
companion object {
val intProperty: Int
inline get() = 6
}
}
@@ -0,0 +1,7 @@
class MyClass {
companion object {
val stringProperty = "-1"
val intProperty = 3
val pairProperty = -1 to 2
}
}
@@ -0,0 +1,8 @@
class MyClass {
companion object {
val stringProperty = "-1"
val intProperty = 2
val pairProperty = -1 to 2
val funcProperty = { 1 }
}
}
@@ -0,0 +1,7 @@
class MyClass {
companion object {
val intProperty = 2
val pairProperty = -1 to 2
val funcProperty = { 2 }
}
}
@@ -0,0 +1,5 @@
class MyClass {
companion object {
val intProperty = 3
}
}
@@ -0,0 +1,6 @@
class MyClass {
companion object {
val intProperty: Int
get() = 4
}
}
@@ -0,0 +1,6 @@
class MyClass {
companion object {
val intProperty: Int
inline get() = 5
}
}
@@ -0,0 +1,40 @@
STEP 0:
modifications:
U : l1.0.kt -> l1.kt
added file: l1.kt
STEP 1:
modifications:
U : l1.1.kt -> l1.kt
modified ir: l1.kt
STEP 2:
modifications:
U : l1.2.kt -> l1.kt
modified ir: l1.kt
STEP 3:
updated exports: l1.kt
STEP 4:
modifications:
U : l1.4.kt -> l1.kt
modified ir: l1.kt
STEP 5:
modifications:
U : l1.5.kt -> l1.kt
modified ir: l1.kt
STEP 6:
updated exports: l1.kt
STEP 7:
modifications:
U : l1.7.kt -> l1.kt
modified ir: l1.kt
STEP 8:
modifications:
U : l1.8.kt -> l1.kt
modified ir: l1.kt
STEP 9:
modifications:
U : l1.9.kt -> l1.kt
modified ir: l1.kt
STEP 10:
modifications:
U : l1.10.kt -> l1.kt
modified ir: l1.kt
@@ -0,0 +1,3 @@
fun test(): Int {
return testStringProperty()
}
@@ -0,0 +1,4 @@
fun test(): Int {
return testStringProperty() +
testIntProperty()
}
@@ -0,0 +1,5 @@
fun test(): Int {
return testStringProperty() +
testIntProperty() +
testPairProperty()
}
@@ -0,0 +1,6 @@
fun test(): Int {
return testStringProperty() +
testIntProperty() +
testPairProperty() +
testFuncProperty()
}
@@ -0,0 +1,3 @@
fun test(): Int {
return testIntProperty() + 4
}
@@ -0,0 +1,3 @@
inline fun testFuncProperty(): Int {
return MyClass.funcProperty()
}
@@ -0,0 +1,3 @@
inline fun testIntProperty(): Int {
return MyClass.intProperty
}
@@ -0,0 +1,3 @@
inline fun testPairProperty(): Int {
return MyClass.pairProperty.first + MyClass.pairProperty.second
}
@@ -0,0 +1,3 @@
inline fun testStringProperty(): Int {
return MyClass.stringProperty.toInt()
}
@@ -0,0 +1,3 @@
inline fun testStringProperty(): Int {
return 0
}
@@ -0,0 +1,50 @@
STEP 0:
dependencies: lib1
modifications:
U : l2string.0.kt -> l2string.kt
U : l2.0.kt -> l2.kt
added file: l2.kt, l2string.kt
STEP 1:
dependencies: lib1
modifications:
U : l2int.1.kt -> l2int.kt
U : l2.1.kt -> l2.kt
added file: l2int.kt
modified ir: l2.kt
STEP 2:
dependencies: lib1
STEP 3:
dependencies: lib1
modifications:
U : l2pair.3.kt -> l2pair.kt
U : l2.3.kt -> l2.kt
added file: l2pair.kt
modified ir: l2.kt
STEP 4:
dependencies: lib1
modifications:
U : l2func.4.kt -> l2func.kt
U : l2.4.kt -> l2.kt
U : l2string.4.kt -> l2string.kt
added file: l2func.kt
modified ir: l2.kt, l2string.kt
STEP 5:
dependencies: lib1
STEP 6:
dependencies: lib1
modifications:
U : l2.6.kt -> l2.kt
modified ir: l2.kt
updated exports: l2pair.kt, l2string.kt, l2func.kt
STEP 7:
dependencies: lib1
modifications:
D : l2pair.kt
D : l2string.kt
D : l2func.kt
STEP 8:
dependencies: lib1
updated imports: l2int.kt
STEP 9..10:
dependencies: lib1
updated imports: l2int.kt, l2.kt
@@ -0,0 +1,4 @@
fun box(stepId: Int): String {
if (test() != stepId) return "Fail"
return "OK"
}
@@ -0,0 +1,5 @@
STEP 0:
dependencies: lib1, lib2
added file: m.kt
STEP 1..10:
dependencies: lib1, lib2
@@ -0,0 +1,20 @@
MODULES: lib1, lib2, main
STEP 0:
libs: lib1, lib2, main
dirty js: lib1, lib2, main
STEP 1:
libs: lib1, lib2, main
dirty js: lib1, lib2
STEP 2:
libs: lib1, lib2, main
dirty js: lib1
STEP 3..4:
libs: lib1, lib2, main
dirty js: lib1, lib2
STEP 5:
libs: lib1, lib2, main
dirty js: lib1
STEP 6..10:
libs: lib1, lib2, main
dirty js: lib1, lib2