[IR][tests] Add tests for remove-inlined-callable member case

This commit is contained in:
Dmitriy Dolovov
2022-06-07 18:34:17 +03:00
parent 9c1c712057
commit 89a188d199
18 changed files with 86 additions and 0 deletions
@@ -0,0 +1 @@
fun foo() = "FAIL1"
@@ -0,0 +1 @@
// fun foo() = "FAIL1"
@@ -0,0 +1,6 @@
STEP 0:
dependencies: stdlib
STEP 1:
dependencies: stdlib
modifications:
U : l1.kt.1 -> l1.kt
@@ -0,0 +1 @@
inline fun bar() = foo()
@@ -0,0 +1,2 @@
STEP 0:
dependencies: stdlib, lib1
@@ -0,0 +1,12 @@
fun box(): String {
try {
return bar()
} catch(e: Throwable) {
if (e.isLinkageError("/foo")) return "OK"
}
return "FAIL2"
}
private fun Throwable.isLinkageError(symbolName: String): Boolean =
this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked IR symbol $symbolName|") == true
@@ -0,0 +1,2 @@
STEP 0:
dependencies: stdlib, lib1, lib2
@@ -0,0 +1,7 @@
MODULES: lib1, lib2, main
STEP 0:
libs: lib1, lib2, main
STEP 1:
libs: lib1
@@ -0,0 +1 @@
val foo: String get() = "FAIL1"
@@ -0,0 +1 @@
// val foo: String get() = "FAIL1"
@@ -0,0 +1,6 @@
STEP 0:
dependencies: stdlib
STEP 1:
dependencies: stdlib
modifications:
U : l1.kt.1 -> l1.kt
@@ -0,0 +1 @@
inline fun bar() = foo
@@ -0,0 +1,2 @@
STEP 0:
dependencies: stdlib, lib1
@@ -0,0 +1,12 @@
fun box(): String {
try {
return bar()
} catch(e: Throwable) {
if (e.isLinkageError("/foo.<get-foo>")) return "OK"
}
return "FAIL2"
}
private fun Throwable.isLinkageError(symbolName: String): Boolean =
this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked IR symbol $symbolName|") == true
@@ -0,0 +1,2 @@
STEP 0:
dependencies: stdlib, lib1, lib2
@@ -0,0 +1,7 @@
MODULES: lib1, lib2, main
STEP 0:
libs: lib1, lib2, main
STEP 1:
libs: lib1
@@ -75,6 +75,16 @@ public class JsKLibABITestCaseGenerated extends AbstractJsKLibABITestCase {
runTest("compiler/testData/klibABI/removeFunction/");
}
@TestMetadata("removeInlinedFunction")
public void testRemoveInlinedFunction() throws Exception {
runTest("compiler/testData/klibABI/removeInlinedFunction/");
}
@TestMetadata("removeInlinedProperty")
public void testRemoveInlinedProperty() throws Exception {
runTest("compiler/testData/klibABI/removeInlinedProperty/");
}
@TestMetadata("removeOpenFunction")
public void testRemoveOpenFunction() throws Exception {
runTest("compiler/testData/klibABI/removeOpenFunction/");
@@ -78,6 +78,18 @@ public class KlibABITestGenerated extends AbstractNativeKlibABITest {
runTest("compiler/testData/klibABI/removeFunction/");
}
@Test
@TestMetadata("removeInlinedFunction")
public void testRemoveInlinedFunction() throws Exception {
runTest("compiler/testData/klibABI/removeInlinedFunction/");
}
@Test
@TestMetadata("removeInlinedProperty")
public void testRemoveInlinedProperty() throws Exception {
runTest("compiler/testData/klibABI/removeInlinedProperty/");
}
@Test
@TestMetadata("removeOpenFunction")
public void testRemoveOpenFunction() throws Exception {