diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/multiplatform/ExpectedActualResolver.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/multiplatform/ExpectedActualResolver.kt index aa2c1e85e04..9247bdfd2ec 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/multiplatform/ExpectedActualResolver.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/multiplatform/ExpectedActualResolver.kt @@ -50,7 +50,7 @@ object ExpectedActualResolver { // TODO: support non-source definitions (e.g. from Java) actual.source.containingFile != SourceFile.NO_SOURCE_FILE }.groupBy { actual -> - areCompatibleCallables(expected, actual) + areCompatibleCallables(expected, actual, platformModule) } } is ClassDescriptor -> { @@ -113,7 +113,9 @@ object ExpectedActualResolver { listOf(module.getPackage(containingDeclaration.fqName).memberScope) } is ClassDescriptor -> { - val classes = containingDeclaration.findClassifiersFromModule(module).filterIsInstance() + val classes = containingDeclaration.findClassifiersFromModule(module) + .mapNotNull { if (it is TypeAliasDescriptor) it.classDescriptor else it } + .filterIsInstance() if (this is ConstructorDescriptor) return classes.flatMap { it.constructors } classes.map { it.unsubstitutedMemberScope } diff --git a/compiler/testData/codegen/box/multiplatform/defaultArguments/typeAlias.kt b/compiler/testData/codegen/box/multiplatform/defaultArguments/typeAlias.kt new file mode 100644 index 00000000000..c208b5894b8 --- /dev/null +++ b/compiler/testData/codegen/box/multiplatform/defaultArguments/typeAlias.kt @@ -0,0 +1,20 @@ +// !LANGUAGE: +MultiPlatformProjects +// WITH_RUNTIME +// FILE: common.kt + +expect annotation class Foo(val z: String = "OK") + +// FILE: platform.kt + +actual typealias Foo = Foo2 + +annotation class Foo2 (val z: String = "OK") + +@Foo +fun test() {} + +fun box(): String { + test() + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/multiplatform/annotationsViaActualTypeAliasFromBinary.kt b/compiler/testData/codegen/boxAgainstJava/multiplatform/annotationsViaActualTypeAliasFromBinary.kt index 2be68b72930..635fb7d069a 100644 --- a/compiler/testData/codegen/boxAgainstJava/multiplatform/annotationsViaActualTypeAliasFromBinary.kt +++ b/compiler/testData/codegen/boxAgainstJava/multiplatform/annotationsViaActualTypeAliasFromBinary.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // !LANGUAGE: +MultiPlatformProjects // WITH_REFLECT // FILE: main.kt diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index fd9e81b43bd..8bd9836c084 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -15969,6 +15969,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { public void testSuperCall() throws Exception { runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/superCall.kt"); } + + @TestMetadata("typeAlias.kt") + public void testTypeAlias() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/typeAlias.kt"); + } } } diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 98216926ce2..f7b5df0ba2c 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -15969,6 +15969,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes public void testParametersInArgumentValues() throws Exception { runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/parametersInArgumentValues.kt"); } + + @TestMetadata("typeAlias.kt") + public void testTypeAlias() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/typeAlias.kt"); + } } } diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index ff36338896f..94ff090ad69 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -15974,6 +15974,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes public void testSuperCall() throws Exception { runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/superCall.kt"); } + + @TestMetadata("typeAlias.kt") + public void testTypeAlias() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/typeAlias.kt"); + } } } diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java index 9b78f13b07a..895843e20b1 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java @@ -12349,6 +12349,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { public void testSuperCall() throws Exception { runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/superCall.kt"); } + + @TestMetadata("typeAlias.kt") + public void testTypeAlias() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/typeAlias.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 fbeb91df14d..9ce562dd739 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 @@ -13444,6 +13444,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { public void testSuperCall() throws Exception { runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/superCall.kt"); } + + @TestMetadata("typeAlias.kt") + public void testTypeAlias() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/typeAlias.kt"); + } } }