diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/KotlinMangler.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/KotlinMangler.kt index 1101ab07e20..97f0d691d8c 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/KotlinMangler.kt +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/KotlinMangler.kt @@ -58,6 +58,10 @@ abstract class KotlinManglerImpl : KotlinMangler { if (declaration.isPlatformSpecificExported()) return true + if (declaration is IrTypeAlias && declaration.parent is IrPackageFragment) { + return true + } + if (descriptorAnnotations.hasAnnotation(publishedApiAnnotation)) { return true } diff --git a/compiler/testData/codegen/box/typealias/privateInKlib.kt b/compiler/testData/codegen/box/typealias/privateInKlib.kt new file mode 100644 index 00000000000..fc9e1658ca3 --- /dev/null +++ b/compiler/testData/codegen/box/typealias/privateInKlib.kt @@ -0,0 +1,22 @@ +// MODULE: lib +// FILE: f1.kt + +private typealias TA = String + +public interface I { + public fun foo(): TA +} + +open public class B: I { + override fun foo() = "OK" +} + +// FILE: f2.kt + + +public class D: B() + +// MODULE: main(lib) +// FILE: m.kt + +fun box() = D().foo() \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index eece3b49929..35966f50c11 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -25131,6 +25131,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/typealias/objectLiteralConstructor.kt"); } + @TestMetadata("privateInKlib.kt") + public void testPrivateInKlib() throws Exception { + runTest("compiler/testData/codegen/box/typealias/privateInKlib.kt"); + } + @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("compiler/testData/codegen/box/typealias/simple.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 5cc5a669c8e..b3e0cd4bca5 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -25131,6 +25131,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/typealias/objectLiteralConstructor.kt"); } + @TestMetadata("privateInKlib.kt") + public void testPrivateInKlib() throws Exception { + runTest("compiler/testData/codegen/box/typealias/privateInKlib.kt"); + } + @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("compiler/testData/codegen/box/typealias/simple.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index d3a619c9605..4921928e01a 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -24031,6 +24031,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/typealias/objectLiteralConstructor.kt"); } + @TestMetadata("privateInKlib.kt") + public void testPrivateInKlib() throws Exception { + runTest("compiler/testData/codegen/box/typealias/privateInKlib.kt"); + } + @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("compiler/testData/codegen/box/typealias/simple.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index bbb5261f590..693630e8b22 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -19181,6 +19181,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/typealias/objectLiteralConstructor.kt"); } + @TestMetadata("privateInKlib.kt") + public void testPrivateInKlib() throws Exception { + runTest("compiler/testData/codegen/box/typealias/privateInKlib.kt"); + } + @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("compiler/testData/codegen/box/typealias/simple.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index d623be891f6..84b2afb2923 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -20336,6 +20336,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/typealias/objectLiteralConstructor.kt"); } + @TestMetadata("privateInKlib.kt") + public void testPrivateInKlib() throws Exception { + runTest("compiler/testData/codegen/box/typealias/privateInKlib.kt"); + } + @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("compiler/testData/codegen/box/typealias/simple.kt");