diff --git a/compiler/testData/klibABI/removeInlinedFunction/lib1/l1.kt b/compiler/testData/klibABI/removeInlinedFunction/lib1/l1.kt new file mode 100644 index 00000000000..801e910b49a --- /dev/null +++ b/compiler/testData/klibABI/removeInlinedFunction/lib1/l1.kt @@ -0,0 +1 @@ +fun foo() = "FAIL1" diff --git a/compiler/testData/klibABI/removeInlinedFunction/lib1/l1.kt.1 b/compiler/testData/klibABI/removeInlinedFunction/lib1/l1.kt.1 new file mode 100644 index 00000000000..07817906933 --- /dev/null +++ b/compiler/testData/klibABI/removeInlinedFunction/lib1/l1.kt.1 @@ -0,0 +1 @@ +// fun foo() = "FAIL1" diff --git a/compiler/testData/klibABI/removeInlinedFunction/lib1/module.info b/compiler/testData/klibABI/removeInlinedFunction/lib1/module.info new file mode 100644 index 00000000000..99edefccd79 --- /dev/null +++ b/compiler/testData/klibABI/removeInlinedFunction/lib1/module.info @@ -0,0 +1,6 @@ +STEP 0: + dependencies: stdlib +STEP 1: + dependencies: stdlib + modifications: + U : l1.kt.1 -> l1.kt diff --git a/compiler/testData/klibABI/removeInlinedFunction/lib2/l2.kt b/compiler/testData/klibABI/removeInlinedFunction/lib2/l2.kt new file mode 100644 index 00000000000..4947025b57c --- /dev/null +++ b/compiler/testData/klibABI/removeInlinedFunction/lib2/l2.kt @@ -0,0 +1 @@ +inline fun bar() = foo() diff --git a/compiler/testData/klibABI/removeInlinedFunction/lib2/module.info b/compiler/testData/klibABI/removeInlinedFunction/lib2/module.info new file mode 100644 index 00000000000..391aab979a6 --- /dev/null +++ b/compiler/testData/klibABI/removeInlinedFunction/lib2/module.info @@ -0,0 +1,2 @@ +STEP 0: + dependencies: stdlib, lib1 \ No newline at end of file diff --git a/compiler/testData/klibABI/removeInlinedFunction/main/m.kt b/compiler/testData/klibABI/removeInlinedFunction/main/m.kt new file mode 100644 index 00000000000..12764ec4816 --- /dev/null +++ b/compiler/testData/klibABI/removeInlinedFunction/main/m.kt @@ -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 diff --git a/compiler/testData/klibABI/removeInlinedFunction/main/module.info b/compiler/testData/klibABI/removeInlinedFunction/main/module.info new file mode 100644 index 00000000000..62f7f4fab07 --- /dev/null +++ b/compiler/testData/klibABI/removeInlinedFunction/main/module.info @@ -0,0 +1,2 @@ +STEP 0: + dependencies: stdlib, lib1, lib2 \ No newline at end of file diff --git a/compiler/testData/klibABI/removeInlinedFunction/project.info b/compiler/testData/klibABI/removeInlinedFunction/project.info new file mode 100644 index 00000000000..2147306d715 --- /dev/null +++ b/compiler/testData/klibABI/removeInlinedFunction/project.info @@ -0,0 +1,7 @@ +MODULES: lib1, lib2, main + +STEP 0: + libs: lib1, lib2, main + +STEP 1: + libs: lib1 \ No newline at end of file diff --git a/compiler/testData/klibABI/removeInlinedProperty/lib1/l1.kt b/compiler/testData/klibABI/removeInlinedProperty/lib1/l1.kt new file mode 100644 index 00000000000..4f18bf01133 --- /dev/null +++ b/compiler/testData/klibABI/removeInlinedProperty/lib1/l1.kt @@ -0,0 +1 @@ +val foo: String get() = "FAIL1" diff --git a/compiler/testData/klibABI/removeInlinedProperty/lib1/l1.kt.1 b/compiler/testData/klibABI/removeInlinedProperty/lib1/l1.kt.1 new file mode 100644 index 00000000000..db178afc070 --- /dev/null +++ b/compiler/testData/klibABI/removeInlinedProperty/lib1/l1.kt.1 @@ -0,0 +1 @@ +// val foo: String get() = "FAIL1" diff --git a/compiler/testData/klibABI/removeInlinedProperty/lib1/module.info b/compiler/testData/klibABI/removeInlinedProperty/lib1/module.info new file mode 100644 index 00000000000..99edefccd79 --- /dev/null +++ b/compiler/testData/klibABI/removeInlinedProperty/lib1/module.info @@ -0,0 +1,6 @@ +STEP 0: + dependencies: stdlib +STEP 1: + dependencies: stdlib + modifications: + U : l1.kt.1 -> l1.kt diff --git a/compiler/testData/klibABI/removeInlinedProperty/lib2/l2.kt b/compiler/testData/klibABI/removeInlinedProperty/lib2/l2.kt new file mode 100644 index 00000000000..eb75fd4dfa9 --- /dev/null +++ b/compiler/testData/klibABI/removeInlinedProperty/lib2/l2.kt @@ -0,0 +1 @@ +inline fun bar() = foo diff --git a/compiler/testData/klibABI/removeInlinedProperty/lib2/module.info b/compiler/testData/klibABI/removeInlinedProperty/lib2/module.info new file mode 100644 index 00000000000..391aab979a6 --- /dev/null +++ b/compiler/testData/klibABI/removeInlinedProperty/lib2/module.info @@ -0,0 +1,2 @@ +STEP 0: + dependencies: stdlib, lib1 \ No newline at end of file diff --git a/compiler/testData/klibABI/removeInlinedProperty/main/m.kt b/compiler/testData/klibABI/removeInlinedProperty/main/m.kt new file mode 100644 index 00000000000..7f8ce5b27c2 --- /dev/null +++ b/compiler/testData/klibABI/removeInlinedProperty/main/m.kt @@ -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 diff --git a/compiler/testData/klibABI/removeInlinedProperty/main/module.info b/compiler/testData/klibABI/removeInlinedProperty/main/module.info new file mode 100644 index 00000000000..62f7f4fab07 --- /dev/null +++ b/compiler/testData/klibABI/removeInlinedProperty/main/module.info @@ -0,0 +1,2 @@ +STEP 0: + dependencies: stdlib, lib1, lib2 \ No newline at end of file diff --git a/compiler/testData/klibABI/removeInlinedProperty/project.info b/compiler/testData/klibABI/removeInlinedProperty/project.info new file mode 100644 index 00000000000..2147306d715 --- /dev/null +++ b/compiler/testData/klibABI/removeInlinedProperty/project.info @@ -0,0 +1,7 @@ +MODULES: lib1, lib2, main + +STEP 0: + libs: lib1, lib2, main + +STEP 1: + libs: lib1 \ No newline at end of file diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsKLibABITestCaseGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsKLibABITestCaseGenerated.java index e4f2d4575fb..c432c00cb61 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsKLibABITestCaseGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsKLibABITestCaseGenerated.java @@ -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/"); diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/KlibABITestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/KlibABITestGenerated.java index af21365c0b5..e0a8495b734 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/KlibABITestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/KlibABITestGenerated.java @@ -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 {