diff --git a/compiler/testData/klibABI/typeAliasRHSTypeChange/lib1/l1.kt b/compiler/testData/klibABI/typeAliasRHSTypeChange/lib1/l1.kt new file mode 100644 index 00000000000..a7224d9a2c1 --- /dev/null +++ b/compiler/testData/klibABI/typeAliasRHSTypeChange/lib1/l1.kt @@ -0,0 +1,3 @@ +typealias S = String + +fun foo(s : S) = s diff --git a/compiler/testData/klibABI/typeAliasRHSTypeChange/lib1/l1.kt.1 b/compiler/testData/klibABI/typeAliasRHSTypeChange/lib1/l1.kt.1 new file mode 100644 index 00000000000..851a0def208 --- /dev/null +++ b/compiler/testData/klibABI/typeAliasRHSTypeChange/lib1/l1.kt.1 @@ -0,0 +1,3 @@ +typealias S = Int + +fun foo(s : S) = s.toString() diff --git a/compiler/testData/klibABI/typeAliasRHSTypeChange/lib1/module.info b/compiler/testData/klibABI/typeAliasRHSTypeChange/lib1/module.info new file mode 100644 index 00000000000..99edefccd79 --- /dev/null +++ b/compiler/testData/klibABI/typeAliasRHSTypeChange/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/typeAliasRHSTypeChange/lib2/l2.kt b/compiler/testData/klibABI/typeAliasRHSTypeChange/lib2/l2.kt new file mode 100644 index 00000000000..a0d9841fe73 --- /dev/null +++ b/compiler/testData/klibABI/typeAliasRHSTypeChange/lib2/l2.kt @@ -0,0 +1,8 @@ +fun bar(): String { + val s: S = "OK" + return s +} + +fun callFoo() { + foo("Hello") +} diff --git a/compiler/testData/klibABI/typeAliasRHSTypeChange/lib2/module.info b/compiler/testData/klibABI/typeAliasRHSTypeChange/lib2/module.info new file mode 100644 index 00000000000..391aab979a6 --- /dev/null +++ b/compiler/testData/klibABI/typeAliasRHSTypeChange/lib2/module.info @@ -0,0 +1,2 @@ +STEP 0: + dependencies: stdlib, lib1 \ No newline at end of file diff --git a/compiler/testData/klibABI/typeAliasRHSTypeChange/main/m.kt b/compiler/testData/klibABI/typeAliasRHSTypeChange/main/m.kt new file mode 100644 index 00000000000..bad2c900875 --- /dev/null +++ b/compiler/testData/klibABI/typeAliasRHSTypeChange/main/m.kt @@ -0,0 +1,13 @@ +fun box(): String { + try { + callFoo() + return "FAIL1" + } catch(e: Throwable) { + if (!e.isLinkageError("/foo")) return "FAIL2" + } + + return bar() +} + +private fun Throwable.isLinkageError(symbolName: String): Boolean = + this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked IR symbol $symbolName|") == true diff --git a/compiler/testData/klibABI/typeAliasRHSTypeChange/main/module.info b/compiler/testData/klibABI/typeAliasRHSTypeChange/main/module.info new file mode 100644 index 00000000000..62f7f4fab07 --- /dev/null +++ b/compiler/testData/klibABI/typeAliasRHSTypeChange/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/typeAliasRHSTypeChange/project.info b/compiler/testData/klibABI/typeAliasRHSTypeChange/project.info new file mode 100644 index 00000000000..2147306d715 --- /dev/null +++ b/compiler/testData/klibABI/typeAliasRHSTypeChange/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 c432c00cb61..89beb7c580e 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 @@ -99,4 +99,9 @@ public class JsKLibABITestCaseGenerated extends AbstractJsKLibABITestCase { public void testRemoveProperty() throws Exception { runTest("compiler/testData/klibABI/removeProperty/"); } + + @TestMetadata("typeAliasRHSTypeChange") + public void testTypeAliasRHSTypeChange() throws Exception { + runTest("compiler/testData/klibABI/typeAliasRHSTypeChange/"); + } } 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 e0a8495b734..15376f81377 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 @@ -107,4 +107,10 @@ public class KlibABITestGenerated extends AbstractNativeKlibABITest { public void testRemoveProperty() throws Exception { runTest("compiler/testData/klibABI/removeProperty/"); } + + @Test + @TestMetadata("typeAliasRHSTypeChange") + public void testTypeAliasRHSTypeChange() throws Exception { + runTest("compiler/testData/klibABI/typeAliasRHSTypeChange/"); + } }