diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated.java index a48d39255ca..b552716ed40 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated.java @@ -97,6 +97,18 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst runTest("compiler/testData/diagnostics/tests/multiplatform/kt54827.kt"); } + @Test + @TestMetadata("kt58153.kt") + public void testKt58153() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/kt58153.kt"); + } + + @Test + @TestMetadata("manyImplMemberNotImplemented.kt") + public void testManyImplMemberNotImplemented() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/manyImplMemberNotImplemented.kt"); + } + @Test @TestMetadata("manyInterfacesMemberNotImplemented.kt") public void testManyInterfacesMemberNotImplemented() throws Exception { @@ -109,6 +121,12 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst runTest("compiler/testData/diagnostics/tests/multiplatform/modifierApplicability.kt"); } + @Test + @TestMetadata("multipleExpectInterfacesImplementation.kt") + public void testMultipleExpectInterfacesImplementation() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/multipleExpectInterfacesImplementation.kt"); + } + @Test @TestMetadata("namedArguments.kt") public void testNamedArguments() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithPsiTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithPsiTestGenerated.java index 2733531a22c..cccf1cbaed5 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithPsiTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithPsiTestGenerated.java @@ -97,6 +97,18 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi runTest("compiler/testData/diagnostics/tests/multiplatform/kt54827.kt"); } + @Test + @TestMetadata("kt58153.kt") + public void testKt58153() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/kt58153.kt"); + } + + @Test + @TestMetadata("manyImplMemberNotImplemented.kt") + public void testManyImplMemberNotImplemented() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/manyImplMemberNotImplemented.kt"); + } + @Test @TestMetadata("manyInterfacesMemberNotImplemented.kt") public void testManyInterfacesMemberNotImplemented() throws Exception { @@ -109,6 +121,12 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi runTest("compiler/testData/diagnostics/tests/multiplatform/modifierApplicability.kt"); } + @Test + @TestMetadata("multipleExpectInterfacesImplementation.kt") + public void testMultipleExpectInterfacesImplementation() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/multipleExpectInterfacesImplementation.kt"); + } + @Test @TestMetadata("namedArguments.kt") public void testNamedArguments() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java index bfd9e77cebf..9306d3b2e62 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java @@ -33351,6 +33351,42 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides.kt"); } + @Test + @TestMetadata("expectActualFakeOverrides2.kt") + public void testExpectActualFakeOverrides2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides2.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverrides3.kt") + public void testExpectActualFakeOverrides3() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides3.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters.kt") + public void testExpectActualFakeOverridesWithTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters2.kt") + public void testExpectActualFakeOverridesWithTypeParameters2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters2.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride.kt") + public void testExpectActualIntersectionOverride() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride2.kt") + public void testExpectActualIntersectionOverride2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride2.kt"); + } + @Test @TestMetadata("expectActualMultiCommon.kt") public void testExpectActualMultiCommon() throws Exception { @@ -33399,6 +33435,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes.kt"); } + @Test + @TestMetadata("expectInterfaceInSupertypes2.kt") + public void testExpectInterfaceInSupertypes2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt"); + } + @Test @TestMetadata("expectProperty.kt") public void testExpectProperty() throws Exception { @@ -33423,6 +33465,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr runTest("compiler/testData/codegen/box/multiplatform/k2/basic/independentCommonSourceModules.kt"); } + @Test + @TestMetadata("interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt") + public void testInterfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt"); + } + @Test @TestMetadata("kt-51753-1.kt") public void testKt_51753_1() throws Exception { @@ -33453,6 +33501,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr runTest("compiler/testData/codegen/box/multiplatform/k2/basic/nonExternalEquals.kt"); } + @Test + @TestMetadata("overridesOfExpectMembers.kt") + public void testOverridesOfExpectMembers() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/overridesOfExpectMembers.kt"); + } + @Test @TestMetadata("removeExpectDeclarationsFromMetadata.kt") public void testRemoveExpectDeclarationsFromMetadata() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java index 04fa9693a46..448a72ca273 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java @@ -33351,6 +33351,42 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides.kt"); } + @Test + @TestMetadata("expectActualFakeOverrides2.kt") + public void testExpectActualFakeOverrides2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides2.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverrides3.kt") + public void testExpectActualFakeOverrides3() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides3.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters.kt") + public void testExpectActualFakeOverridesWithTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters2.kt") + public void testExpectActualFakeOverridesWithTypeParameters2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters2.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride.kt") + public void testExpectActualIntersectionOverride() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride2.kt") + public void testExpectActualIntersectionOverride2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride2.kt"); + } + @Test @TestMetadata("expectActualMultiCommon.kt") public void testExpectActualMultiCommon() throws Exception { @@ -33399,6 +33435,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes.kt"); } + @Test + @TestMetadata("expectInterfaceInSupertypes2.kt") + public void testExpectInterfaceInSupertypes2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt"); + } + @Test @TestMetadata("expectProperty.kt") public void testExpectProperty() throws Exception { @@ -33423,6 +33465,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo runTest("compiler/testData/codegen/box/multiplatform/k2/basic/independentCommonSourceModules.kt"); } + @Test + @TestMetadata("interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt") + public void testInterfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt"); + } + @Test @TestMetadata("kt-51753-1.kt") public void testKt_51753_1() throws Exception { @@ -33453,6 +33501,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo runTest("compiler/testData/codegen/box/multiplatform/k2/basic/nonExternalEquals.kt"); } + @Test + @TestMetadata("overridesOfExpectMembers.kt") + public void testOverridesOfExpectMembers() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/overridesOfExpectMembers.kt"); + } + @Test @TestMetadata("removeExpectDeclarationsFromMetadata.kt") public void testRemoveExpectDeclarationsFromMetadata() throws Exception { diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/CommonBackendErrors.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/CommonBackendErrors.kt index 9c898fa6565..44c4e70eee5 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/CommonBackendErrors.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/CommonBackendErrors.kt @@ -17,6 +17,7 @@ import org.jetbrains.kotlin.diagnostics.rendering.RootDiagnosticRendererFactory object CommonBackendErrors { val NO_ACTUAL_FOR_EXPECT by error2() val MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED by error2() + val MANY_IMPL_MEMBER_NOT_IMPLEMENTED by error2() init { RootDiagnosticRendererFactory.registerFactory(KtDefaultCommonBackendErrorMessages) @@ -37,5 +38,11 @@ object KtDefaultCommonBackendErrorMessages : BaseDiagnosticRendererFactory() { STRING, STRING, ) + map.put( + CommonBackendErrors.MANY_IMPL_MEMBER_NOT_IMPLEMENTED, + "{0} must override {1} because it inherits many implementations of it", + STRING, + STRING, + ) } } diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/ActualFakeOverridesAdder.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/ActualFakeOverridesAdder.kt new file mode 100644 index 00000000000..96d2b0b5f08 --- /dev/null +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/ActualFakeOverridesAdder.kt @@ -0,0 +1,120 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.backend.common.actualizer + +import org.jetbrains.kotlin.KtDiagnosticReporterWithImplicitIrBasedContext +import org.jetbrains.kotlin.backend.common.CommonBackendErrors +import org.jetbrains.kotlin.descriptors.DescriptorVisibilities +import org.jetbrains.kotlin.ir.IrElement +import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.symbols.IrSymbol +import org.jetbrains.kotlin.ir.types.classifierOrFail +import org.jetbrains.kotlin.ir.util.isInterface +import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid +import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid + +/** + * It adds fake overrides to non-expect classes inside common or multi-platform module, + * taken from these non-expect classes actualized super classes. + * + * In case when a non-expect class has direct or indirect expect supertypes, + * it may happen that the actual classes for these supertypes contain additional (non-actual) members that don't exist in their expect counterparts. + * We still should have fake overrides generated for these members, but FIR2IR isn't able to see their base members in common or multi-platform module. + * This class is intended to search for such situations and generate such fake overrides. + */ +internal class ActualFakeOverridesAdder( + private val expectActualMap: Map, + private val diagnosticsReporter: KtDiagnosticReporterWithImplicitIrBasedContext +) : IrElementVisitorVoid { + private val missingActualMembersMap = mutableMapOf>>() + + override fun visitClass(declaration: IrClass) { + extractMissingActualMembersFromSupertypes(declaration) + visitElement(declaration) + } + + override fun visitElement(element: IrElement) { + element.acceptChildrenVoid(this) + } + + private fun extractMissingActualMembersFromSupertypes(klass: IrClass): Map> { + missingActualMembersMap[klass]?.let { return it } + + val missingActualMembers = mutableMapOf>() + missingActualMembersMap[klass] = missingActualMembers + + // New members from supertypes are only relevant for not expect (ordinary) classes + // New members from the current class are only relevant for actualized expect classes + + val processedMembers = mutableMapOf>() + for (superType in klass.superTypes) { + val membersFromSupertype = extractMissingActualMembersFromSupertypes(superType.classifierOrFail.owner as IrClass) + if (!klass.isExpect) { + missingActualMembers.appendMissingMembersToNotExpectClass(klass, membersFromSupertype, processedMembers) + } + } + + val actualClass = expectActualMap[klass.symbol]?.owner as? IrClass ?: return missingActualMembers + + missingActualMembers.appendMissingMembersFromActualizedExpectClass(klass, actualClass) + + return missingActualMembers + } + + private fun MutableMap>.appendMissingMembersToNotExpectClass( + klass: IrClass, + membersFromSupertype: Map>, + processedMembers: MutableMap> + ) { + for (memberFromSupertype in membersFromSupertype.flatMap { it.value }) { + val newMember = createFakeOverrideMember(listOf(memberFromSupertype), klass) + val name = newMember.getFunctionOrPropertyName() + if (getMatches(name, newMember, expectActualMap).isEmpty()) { + processedMembers.addMember(memberFromSupertype as IrOverridableDeclaration<*>) + addMember(newMember) + klass.addMember(newMember) + } else { + val baseMember = processedMembers.getMatches(name, newMember, expectActualMap).single() + val errorFactory = + if ((baseMember.parent as IrClass).isInterface && (memberFromSupertype.parent as IrClass).isInterface) + CommonBackendErrors.MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED + else + CommonBackendErrors.MANY_IMPL_MEMBER_NOT_IMPLEMENTED + diagnosticsReporter.at(klass).report( + errorFactory, + klass.name.asString(), + (memberFromSupertype as IrDeclarationWithName).name.asString() + ) + } + } + } + + private fun MutableMap>.appendMissingMembersFromActualizedExpectClass( + expectClass: IrClass, + actualClass: IrClass, + ) { + val actualWithCorrespondingExpectMembers = hashSetOf().apply { + expectClass.declarations.mapNotNullTo(this) { expectActualMap[(it as? IrOverridableDeclaration<*>)?.symbol] } + } + + for (actualMember in actualClass.declarations) { + if (actualMember is IrOverridableDeclaration<*> && + (actualMember as? IrDeclarationWithVisibility)?.visibility != DescriptorVisibilities.PRIVATE && + !actualWithCorrespondingExpectMembers.contains(actualMember.symbol) + ) { + addMember(actualMember) + } + } + } + + private fun MutableMap>.addMember(member: IrOverridableDeclaration<*>) { + getOrPut(member.getFunctionOrPropertyName()) { mutableListOf() }.add(member) + } + + private fun IrOverridableDeclaration<*>.getFunctionOrPropertyName(): String { + return (this as IrDeclarationWithName).name.asString() + (if (this is IrSimpleFunction) "()" else "") + } +} \ No newline at end of file diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/ExpectActualCollector.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/ExpectActualCollector.kt index d10d7cd5d43..d0696009c13 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/ExpectActualCollector.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/ExpectActualCollector.kt @@ -11,6 +11,7 @@ import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.symbols.IrSymbol import org.jetbrains.kotlin.ir.types.classifierOrFail +import org.jetbrains.kotlin.ir.util.isFakeOverride import org.jetbrains.kotlin.ir.util.kotlinFqName import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid @@ -21,12 +22,12 @@ internal class ExpectActualCollector( private val dependentFragments: List, private val diagnosticsReporter: KtDiagnosticReporterWithImplicitIrBasedContext ) { - fun collect(): Pair, Map> { + fun collect(): MutableMap { val result = mutableMapOf() // Collect and link classes at first to make it possible to expand type aliases on the members linking val (actualMembers, expectActualTypeAliasMap) = result.appendExpectActualClassMap() result.appendExpectActualMemberMap(actualMembers, expectActualTypeAliasMap) - return result to expectActualTypeAliasMap + return result } private fun MutableMap.appendExpectActualClassMap(): Pair, Map> { @@ -157,39 +158,37 @@ private class MemberLinksCollector( if ((declaration.parent as IrClass).isExpect) addLink(declaration) } - private fun addLink(declaration: IrDeclarationBase) { - val actualMemberMatches = actualMembers.getMatches(declaration, expectActualMap, typeAliasMap) + private fun addLink(expectDeclaration: IrDeclarationBase) { + val actualMemberMatches = actualMembers.getMatches(expectDeclaration, expectActualMap, typeAliasMap) when { actualMemberMatches.size == 1 -> { - val actualMember = actualMemberMatches.single() - expectActualMap[declaration.symbol] = actualMember.symbol - if (declaration is IrProperty) { - val actualProperty = actualMember as IrProperty - declaration.getter?.let { - val getter = actualProperty.getter!! - expectActualMap[it.symbol] = getter.symbol - expectActualMap.appendTypeParametersMap(it, getter) - } - declaration.setter?.symbol?.let { expectActualMap[it] = actualProperty.setter!!.symbol } - } else if (declaration is IrFunction) { - expectActualMap.appendTypeParametersMap(declaration, actualMember as IrFunction) - } + expectActualMap.addLink(expectDeclaration, actualMemberMatches.single()) } actualMemberMatches.size > 1 -> { // TODO: report AMBIGUOUS_ACTUALS here, see KT-57932 } - !declaration.parent.containsOptionalExpectation() && !(declaration is IrConstructor && declaration.isPrimary) -> { - diagnosticsReporter.reportMissingActual(declaration) + (expectDeclaration.parent as? IrClass)?.isExpect == false && expectDeclaration.isFakeOverride -> { + // Remaining expect fake override members from not expect classes will be actualized in FakeOverridesTransformer + // It occurs in a separated step because they require filled expectActualMap for members from expect classes + } + else -> { + if (shouldReportMissingActual(expectDeclaration)) { + diagnosticsReporter.reportMissingActual(expectDeclaration) + } } } } + private fun shouldReportMissingActual(declaration: IrDeclarationBase): Boolean { + return !declaration.parent.containsOptionalExpectation() && !(declaration is IrConstructor && declaration.isPrimary) + } + override fun visitElement(element: IrElement) { element.acceptChildrenVoid(this) } } -private fun MutableMap.appendTypeParametersMap( +fun MutableMap.appendTypeParametersMap( expectTypeParametersContainer: IrTypeParametersContainer, actualTypeParametersContainer: IrTypeParametersContainer ) { diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/ExpectActualLinker.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/ExpectActualLinker.kt index b33c4fb04bc..ba19bc4caf0 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/ExpectActualLinker.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/ExpectActualLinker.kt @@ -7,7 +7,11 @@ package org.jetbrains.kotlin.backend.common.actualizer import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.symbols.* -import org.jetbrains.kotlin.ir.util.* +import org.jetbrains.kotlin.ir.util.DeepCopyIrTreeWithSymbols +import org.jetbrains.kotlin.ir.util.SymbolRemapper +import org.jetbrains.kotlin.ir.util.SymbolRenamer +import org.jetbrains.kotlin.ir.util.TypeRemapper +import org.jetbrains.kotlin.utils.memoryOptimizedMap internal class ActualizerSymbolRemapper(private val expectActualMap: Map) : SymbolRemapper { override fun getDeclaredClass(symbol: IrClassSymbol) = symbol @@ -71,7 +75,7 @@ internal class ActualizerSymbolRemapper(private val expectActualMap: Map S.actualizeSymbol(): S = (expectActualMap[this] as? S) ?: this } -internal open class ActualizerVisitor(symbolRemapper: SymbolRemapper, typeRemapper: TypeRemapper) : +internal open class ActualizerVisitor(private val symbolRemapper: SymbolRemapper, typeRemapper: TypeRemapper) : DeepCopyIrTreeWithSymbols(symbolRemapper, typeRemapper, SymbolRenamer.DEFAULT) { override fun visitModuleFragment(declaration: IrModuleFragment) = declaration.also { it.transformChildren(this, null) } @@ -94,7 +98,11 @@ internal open class ActualizerVisitor(symbolRemapper: SymbolRemapper, typeRemapp it.transformChildren(this, null) } - override fun visitSimpleFunction(declaration: IrSimpleFunction) = visitFunction(declaration) as IrSimpleFunction + override fun visitSimpleFunction(declaration: IrSimpleFunction) = (visitFunction(declaration) as IrSimpleFunction).also { + it.overriddenSymbols = it.overriddenSymbols.memoryOptimizedMap { symbol -> + symbolRemapper.getReferencedFunction(symbol) as IrSimpleFunctionSymbol + } + } override fun visitConstructor(declaration: IrConstructor) = visitFunction(declaration) as IrConstructor @@ -105,7 +113,12 @@ internal open class ActualizerVisitor(symbolRemapper: SymbolRemapper, typeRemapp } override fun visitProperty(declaration: IrProperty) = - declaration.also { it.transformChildren(this, null) } + declaration.also { + it.transformChildren(this, null) + it.overriddenSymbols = it.overriddenSymbols.memoryOptimizedMap { symbol -> + symbolRemapper.getReferencedProperty(symbol) + } + } override fun visitField(declaration: IrField) = declaration.also { diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/FakeOverridesActualizer.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/FakeOverridesActualizer.kt new file mode 100644 index 00000000000..f1b4887b39b --- /dev/null +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/FakeOverridesActualizer.kt @@ -0,0 +1,57 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.backend.common.actualizer + +import org.jetbrains.kotlin.backend.common.ir.isExpect +import org.jetbrains.kotlin.ir.IrElement +import org.jetbrains.kotlin.ir.declarations.IrClass +import org.jetbrains.kotlin.ir.declarations.IrDeclaration +import org.jetbrains.kotlin.ir.declarations.IrDeclarationBase +import org.jetbrains.kotlin.ir.declarations.IrOverridableDeclaration +import org.jetbrains.kotlin.ir.symbols.IrSymbol +import org.jetbrains.kotlin.ir.util.isFakeOverride +import org.jetbrains.kotlin.ir.util.transformInPlace +import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid +import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid + +/** + * It actualizes expect fake overrides in non-expect classes inside common or multi-platform module. + * + * When some non-expect class inside a common or multi-platform module has an expect base class, + * FIR2IR generates expect fake overrides overriding the expect base class members for this non-expect class which is not correct for the backend. + * This Actualizer processes expect overridable declarations in non-expect classes and replaces them with the associated actual overridable + * declarations overriding the actual base class members.The newly created actual fake overrides are stored in expectActualMap. + */ +internal class FakeOverridesActualizer(private val expectActualMap: MutableMap) : IrElementVisitorVoid { + override fun visitClass(declaration: IrClass) { + if (!declaration.isExpect) { + actualizeFakeOverrides(declaration) + } + visitElement(declaration) + } + + override fun visitElement(element: IrElement) { + element.acceptChildrenVoid(this) + } + + private fun actualizeFakeOverrides(klass: IrClass) { + fun IrDeclaration.actualize(): IrDeclaration { + if (!isExpect) return this + + (expectActualMap[symbol]?.owner as? IrDeclaration)?.let { return it } + + require(this is IrOverridableDeclaration<*>) + val actualizedOverrides = overriddenSymbols.map { (it.owner as IrDeclaration).actualize() } + val actualFakeOverride = createFakeOverrideMember(actualizedOverrides, parent as IrClass) + + expectActualMap.addLink(this as IrDeclarationBase, actualFakeOverride) + + return actualFakeOverride + } + + klass.declarations.transformInPlace { if (it.isExpect && it.isFakeOverride) it.actualize() else it } + } +} \ No newline at end of file diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/IrActualizer.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/IrActualizer.kt index 480aa18bf92..74766904217 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/IrActualizer.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/IrActualizer.kt @@ -23,27 +23,40 @@ object IrActualizer { ): IrActualizedResult { val ktDiagnosticReporter = KtDiagnosticReporterWithImplicitIrBasedContext(diagnosticReporter, languageVersionSettings) - val (expectActualMap, expectActualTypeAliasMap) = ExpectActualCollector( + // The ir modules processing is performed phase-to-phase: + // 1. Collect expect-actual links for classes and their members from dependent fragments + val expectActualMap = ExpectActualCollector( mainFragment, dependentFragments, ktDiagnosticReporter ).collect() + // 2. Remove top-only expect declarations since they are not needed anymore and should not be presented in the final IrFragment + // Expect fake-overrides from non-expect classes remain untouched since they will be actualized in the next phase. + // Also, it doesn't remove unactualized expect declarations marked with @OptionalExpectation val removedExpectDeclarations = removeExpectDeclarations(dependentFragments, expectActualMap) + // 3. Actualize expect fake overrides in non-expect classes inside common or multi-platform module. + // It's probably important to run FakeOverridesActualizer before ActualFakeOverridesAdder + FakeOverridesActualizer(expectActualMap).apply { dependentFragments.forEach { visitModuleFragment(it) } } + + // 4. Add fake overrides to non-expect classes inside common or multi-platform module, + // taken from these non-expect classes actualized super classes. + ActualFakeOverridesAdder( + expectActualMap, + ktDiagnosticReporter + ).apply { dependentFragments.forEach { visitModuleFragment(it) } } + + // 5. Copy and actualize function parameter default values from expect functions val symbolRemapper = ActualizerSymbolRemapper(expectActualMap) val typeRemapper = DeepCopyTypeRemapper(symbolRemapper) FunctionDefaultParametersActualizer(symbolRemapper, typeRemapper, expectActualMap).actualize() - MissingFakeOverridesAdder( - expectActualMap, - expectActualTypeAliasMap, - ktDiagnosticReporter - ).apply { dependentFragments.forEach { visitModuleFragment(it) } } - + // 6. Actualize expect calls in dependent fragments using info obtained in the previous steps val actualizerVisitor = ActualizerVisitor(symbolRemapper, typeRemapper) dependentFragments.forEach { it.transform(actualizerVisitor, null) } + // 7. Merge dependent fragments into the main one mergeIrFragments(mainFragment, dependentFragments) return IrActualizedResult(removedExpectDeclarations) diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/IrActualizerUtils.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/IrActualizerUtils.kt index 9a5a4e67931..433643fd18a 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/IrActualizerUtils.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/IrActualizerUtils.kt @@ -10,18 +10,20 @@ import org.jetbrains.kotlin.backend.common.CommonBackendErrors import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI +import org.jetbrains.kotlin.ir.builders.declarations.buildFun +import org.jetbrains.kotlin.ir.builders.declarations.buildProperty import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol import org.jetbrains.kotlin.ir.symbols.IrSymbol import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol import org.jetbrains.kotlin.ir.types.IrDynamicType import org.jetbrains.kotlin.ir.types.classifierOrFail import org.jetbrains.kotlin.ir.types.isNullable -import org.jetbrains.kotlin.ir.util.hasAnnotation -import org.jetbrains.kotlin.ir.util.kotlinFqName -import org.jetbrains.kotlin.ir.util.module +import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.StandardClassIds import org.jetbrains.kotlin.resolve.multiplatform.OptionalAnnotationUtil +import org.jetbrains.kotlin.utils.addToStdlib.runIf private val FLEXIBLE_NULLABILITY_ANNOTATION_FQ_NAME = StandardClassIds.Annotations.FlexibleNullability.asSingleFqName() @@ -29,8 +31,15 @@ internal fun Map>.getMatches( expectDeclaration: IrDeclaration, expectActualTypesMap: Map, expectActualTypeAliasMap: Map +): List = + getMatches(generateIrElementFullNameFromExpect(expectDeclaration, expectActualTypeAliasMap), expectDeclaration, expectActualTypesMap) + +internal fun Map>.getMatches( + mainSignature: String, + expectDeclaration: IrDeclaration, + expectActualTypesMap: Map ): List { - val members = this[generateIrElementFullNameFromExpect(expectDeclaration, expectActualTypeAliasMap)] ?: return emptyList() + val members = this[mainSignature] ?: return emptyList() return when (expectDeclaration) { is IrFunction -> members.getMatches(expectDeclaration, expectActualTypesMap) { it as IrFunction } is IrProperty -> members.getMatches(expectDeclaration, expectActualTypesMap) { (it as IrProperty).getter!! } @@ -167,6 +176,21 @@ private fun appendElementFullName( } } +internal fun MutableMap.addLink(expectMember: IrDeclarationBase, actualMember: IrDeclaration) { + this[expectMember.symbol] = actualMember.symbol + if (expectMember is IrProperty) { + val actualProperty = actualMember as IrProperty + expectMember.getter!!.let { + val getter = actualProperty.getter!! + this[it.symbol] = getter.symbol + this.appendTypeParametersMap(it, getter) + } + expectMember.setter?.symbol?.let { this[it] = actualProperty.setter!!.symbol } + } else if (expectMember is IrFunction) { + this.appendTypeParametersMap(expectMember, actualMember as IrFunction) + } +} + @OptIn(ObsoleteDescriptorBasedAPI::class) internal fun KtDiagnosticReporterWithImplicitIrBasedContext.reportMissingActual(irDeclaration: IrDeclaration) { at(irDeclaration).report( @@ -181,3 +205,67 @@ internal fun IrElement.containsOptionalExpectation(): Boolean { this.kind == ClassKind.ANNOTATION_CLASS && this.hasAnnotation(OptionalAnnotationUtil.OPTIONAL_EXPECTATION_FQ_NAME) } + +@Suppress("UNCHECKED_CAST") +internal fun createFakeOverrideMember(actualMembers: List, declaration: IrClass): IrOverridableDeclaration<*> { + return when (actualMembers.first()) { + is IrSimpleFunction -> createFakeOverrideFunction(actualMembers as List, declaration) + is IrProperty -> createFakeOverrideProperty(actualMembers as List, declaration) + else -> error("Only function or property can be overridden") + } +} + +private fun createFakeOverrideProperty(actualProperties: List, parent: IrClass): IrProperty { + val actualProperty = actualProperties.first() // TODO: Currently FIR2IR works in the similar way but it looks incorrect + return parent.factory.buildProperty { + updateFrom(actualProperty) + name = actualProperty.name + origin = IrDeclarationOrigin.FAKE_OVERRIDE + isFakeOverride = true + isExpect = false + }.apply { + this.parent = parent + annotations = actualProperty.annotations + backingField = null + getter = createFakeOverrideFunction(actualProperties.map { it.getter as IrSimpleFunction }, parent, symbol) + setter = runIf(actualProperty.setter != null) { + createFakeOverrideFunction(actualProperties.map { it.setter as IrSimpleFunction }, parent, symbol) + } + overriddenSymbols = actualProperties.map { it.symbol } + } +} + +private fun createFakeOverrideFunction( + actualFunctions: List, + parent: IrDeclarationParent, + correspondingPropertySymbol: IrPropertySymbol? = null +): IrSimpleFunction { + val actualFunction = actualFunctions.first() // TODO: Currently FIR2IR works in the similar way but it looks incorrect + + return actualFunction.factory.buildFun { + updateFrom(actualFunction) + name = actualFunction.name + returnType = actualFunction.returnType + origin = IrDeclarationOrigin.FAKE_OVERRIDE + isFakeOverride = true + isExpect = false + }.also { + it.parent = parent + it.annotations = actualFunction.annotations.map { p -> p.deepCopyWithSymbols(it) } + it.typeParameters = actualFunction.typeParameters.map { p -> p.deepCopyWithSymbols(it) } + + val typeRemapper = IrTypeParameterRemapper(actualFunction.typeParameters.zip(it.typeParameters).toMap()) + fun IrValueParameter.deepCopyWithTypeParameters(): IrValueParameter = deepCopyWithSymbols(it) { symbolRemapper, _ -> + DeepCopyIrTreeWithSymbols(symbolRemapper, typeRemapper) + } + + it.dispatchReceiverParameter = actualFunction.dispatchReceiverParameter?.deepCopyWithTypeParameters() + it.extensionReceiverParameter = actualFunction.extensionReceiverParameter?.deepCopyWithTypeParameters() + it.valueParameters = actualFunction.valueParameters.map { p -> p.deepCopyWithTypeParameters() } + it.contextReceiverParametersCount = actualFunction.contextReceiverParametersCount + it.metadata = actualFunction.metadata + it.overriddenSymbols = actualFunctions.map { f -> f.symbol } + it.attributeOwnerId = it + it.correspondingPropertySymbol = correspondingPropertySymbol + } +} \ No newline at end of file diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/MissingFakeOverridesAdder.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/MissingFakeOverridesAdder.kt deleted file mode 100644 index 828b5f14544..00000000000 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/MissingFakeOverridesAdder.kt +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.backend.common.actualizer - -import org.jetbrains.kotlin.KtDiagnosticReporterWithImplicitIrBasedContext -import org.jetbrains.kotlin.backend.common.CommonBackendErrors -import org.jetbrains.kotlin.descriptors.DescriptorVisibilities -import org.jetbrains.kotlin.ir.IrElement -import org.jetbrains.kotlin.ir.builders.declarations.buildFun -import org.jetbrains.kotlin.ir.builders.declarations.buildProperty -import org.jetbrains.kotlin.ir.declarations.* -import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl -import org.jetbrains.kotlin.ir.declarations.impl.IrPropertyImpl -import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol -import org.jetbrains.kotlin.ir.symbols.IrSymbol -import org.jetbrains.kotlin.ir.types.classifierOrFail -import org.jetbrains.kotlin.ir.types.isAny -import org.jetbrains.kotlin.ir.util.deepCopyWithSymbols -import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid -import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid -import org.jetbrains.kotlin.name.FqName - -internal class MissingFakeOverridesAdder( - private val expectActualMap: Map, - private val typeAliasMap: Map, - private val diagnosticsReporter: KtDiagnosticReporterWithImplicitIrBasedContext -) : IrElementVisitorVoid { - override fun visitClass(declaration: IrClass) { - if (!declaration.isExpect) { - processSupertypes(declaration) - } - visitElement(declaration) - } - - override fun visitElement(element: IrElement) { - element.acceptChildrenVoid(this) - } - - private fun processSupertypes(declaration: IrClass) { - val members by lazy(LazyThreadSafetyMode.NONE) { - val notBuiltinMembers = declaration.declarations.filterNot { it.isBuiltinMember() } - val result = mutableMapOf>() - for (member in notBuiltinMembers) { - result.getOrPut(generateIrElementFullNameFromExpect(member, typeAliasMap)) { mutableListOf() }.add(member) - } - result - } - - for (superType in declaration.superTypes) { - val expectClass = superType.classifierOrFail.owner as? IrClass ?: continue - val added = mutableSetOf() - for (expectMember in expectClass.declarations) { - if (expectMember.isBuiltinMember()) continue - val actualMember = expectActualMap[expectMember.symbol]?.owner as? IrDeclaration ?: continue - added += actualMember - - // Do not add FAKE_OVERRIDE if the subclass already has overridden member - if (declaration.declarations.filterIsInstance>() - .any { expectMember.symbol in it.overriddenSymbols } - ) { - continue - } - addFakeOverride(actualMember, members, declaration) - } - val actualClass = expectActualMap[expectClass.symbol]?.owner as? IrClass ?: continue - for (actualMember in actualClass.declarations) { - if (actualMember.isBuiltinMember() || actualMember in added) continue - if ((actualMember as? IrDeclarationWithVisibility)?.visibility == DescriptorVisibilities.PRIVATE) continue - addFakeOverride(actualMember, members, declaration) - } - } - } - - private fun addFakeOverride( - actualMember: IrDeclaration, - members: MutableMap>, - declaration: IrClass - ) { - val newMember = when (actualMember) { - is IrFunctionImpl -> createFakeOverrideFunction(actualMember, declaration) - is IrPropertyImpl -> createFakeOverrideProperty(actualMember, declaration) - else -> return - } - - if (members.getMatches(newMember, expectActualMap, typeAliasMap).isEmpty()) { - declaration.declarations.add(newMember) - members.getOrPut(generateIrElementFullNameFromExpect(newMember, typeAliasMap)) { mutableListOf() }.add(newMember) - } else { - diagnosticsReporter.at(declaration).report( - CommonBackendErrors.MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED, - declaration.name.asString(), - (actualMember as IrDeclarationWithName).name.asString() - ) - } - } -} - -private fun IrDeclaration.isBuiltinMember(): Boolean { - if (this !is IrFunction) return false - return this is IrConstructor || dispatchReceiverParameter?.type?.isAny() == true -} - -private fun createFakeOverrideProperty(actualMember: IrPropertyImpl, declaration: IrClass) = - declaration.factory.buildProperty { - updateFrom(actualMember) - name = actualMember.name - origin = IrDeclarationOrigin.FAKE_OVERRIDE - }.apply { - parent = declaration - annotations = actualMember.annotations - backingField = actualMember.backingField - getter = (actualMember.getter as? IrFunctionImpl)?.let { getter -> - createFakeOverrideFunction(getter, declaration, symbol) - } - setter = (actualMember.setter as? IrFunctionImpl)?.let { setter -> - createFakeOverrideFunction(setter, declaration, symbol) - } - overriddenSymbols = listOf(actualMember.symbol) - } - -private fun createFakeOverrideFunction( - actualFunction: IrFunctionImpl, - parent: IrDeclarationParent, - correspondingPropertySymbol: IrPropertySymbol? = null -) = actualFunction.factory.buildFun { - updateFrom(actualFunction) - name = actualFunction.name - returnType = actualFunction.returnType - origin = IrDeclarationOrigin.FAKE_OVERRIDE - isFakeOverride = true - isExpect = false -}.also { - it.parent = parent - it.annotations = actualFunction.annotations.map { p -> p.deepCopyWithSymbols(it) } - it.typeParameters = actualFunction.typeParameters.map { p -> p.deepCopyWithSymbols(it) } - it.dispatchReceiverParameter = actualFunction.dispatchReceiverParameter?.deepCopyWithSymbols(it) - it.extensionReceiverParameter = actualFunction.extensionReceiverParameter?.deepCopyWithSymbols(it) - it.valueParameters = actualFunction.valueParameters.map { p -> p.deepCopyWithSymbols(it) } - it.contextReceiverParametersCount = actualFunction.contextReceiverParametersCount - it.metadata = actualFunction.metadata - it.overriddenSymbols = listOf(actualFunction.symbol) - it.attributeOwnerId = it - it.correspondingPropertySymbol = correspondingPropertySymbol -} diff --git a/compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides2.kt b/compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides2.kt new file mode 100644 index 00000000000..5125133d646 --- /dev/null +++ b/compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides2.kt @@ -0,0 +1,29 @@ +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE +// !LANGUAGE: +MultiPlatformProjects +// ISSUE: KT-58003 + +// MODULE: common +// FILE: common.kt + +class C3 : C2() + +open class C2 : C1() + +expect open class C1() { + fun o(): String + + val k: String +} + +fun foo(c3: C3) = c3.o() + c3.k + +// MODULE: platform()()(common) +// FILE: platform.kt + +actual open class C1 { + actual fun o() = "O" + + actual val k = "K" +} + +fun box() = foo(C3()) \ No newline at end of file diff --git a/compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides3.kt b/compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides3.kt new file mode 100644 index 00000000000..eab6c0f5a0c --- /dev/null +++ b/compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides3.kt @@ -0,0 +1,29 @@ +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE +// !LANGUAGE: +MultiPlatformProjects +// ISSUE: KT-57984 + +// MODULE: common +// FILE: common.kt + +expect interface I { + fun ok(): String +} +interface I2 : I + +fun ok(c: I2) = c.ok() + +// MODULE: lib()()(common) +// FILE: lib.kt + +actual interface I { + actual fun ok(): String +} + +// MODULE: main(lib) +// FILE: main.kt + +class C : I2 { + override fun ok(): String = "OK" +} + +fun box() = ok(C()) \ No newline at end of file diff --git a/compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters.kt b/compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters.kt new file mode 100644 index 00000000000..df54e59d5a5 --- /dev/null +++ b/compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters.kt @@ -0,0 +1,31 @@ +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE +// !LANGUAGE: +MultiPlatformProjects +// ISSUE: KT-58004 + +// MODULE: common +// FILE: common.kt + +expect open class A() { + fun f(arg: T): T + + fun g(s: S): S + + val S.p: S +} + +class B : A() + +fun foo(arg: B) = arg.f("O") + arg.g("K") + +// MODULE: platform()()(common) +// FILE: platform.kt + +actual open class A { + actual fun f(arg: T) = arg + + actual fun g(s: S): S = s.p + + actual val S.p: S get() = this +} + +fun box() = foo(B()) \ No newline at end of file diff --git a/compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters2.kt b/compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters2.kt new file mode 100644 index 00000000000..df194a89fb2 --- /dev/null +++ b/compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters2.kt @@ -0,0 +1,38 @@ +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE +// !LANGUAGE: +MultiPlatformProjects + +// MODULE: common +// FILE: common.kt + +public class X: I1 { + override fun f(a: A): A = a +} + +public interface I1 : I2 + +public expect interface I2 { + public fun f(a: A): A +} + +public class Y: I3 { + override fun f(b: B): B = b +} + +public interface I3 : I4 + +public expect interface I4 { + public fun f(b: B): B +} + +fun box() = X().f("O") + Y().f("K") + +// MODULE: platform()()(common) +// FILE: platform.kt + +public actual interface I2 { + public actual fun f(a: A): A +} + +public actual interface I4 { + public actual fun f(b: B): B +} diff --git a/compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride.kt b/compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride.kt new file mode 100644 index 00000000000..945f83c0e5f --- /dev/null +++ b/compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride.kt @@ -0,0 +1,27 @@ +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE +// !LANGUAGE: +MultiPlatformProjects +// ISSUE: KT-58124 + +// MODULE: common +// FILE: common.kt + +interface I1 { + fun f(): String +} + +interface I2 { + fun f(): String +} + +expect class C() : I1, I2 + +fun test() = C().f() + +// MODULE: platform()()(common) +// FILE: platform.kt + +actual class C : I1, I2 { + override fun f() = "OK" +} + +fun box() = test() \ No newline at end of file diff --git a/compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride2.kt b/compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride2.kt new file mode 100644 index 00000000000..7790a5bac96 --- /dev/null +++ b/compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride2.kt @@ -0,0 +1,39 @@ +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE +// !LANGUAGE: +MultiPlatformProjects + +// MODULE: common +// FILE: common.kt + +class C() : I1, C1() + +expect open class C1() { + fun o(): String + + val k: String +} + +expect interface I1 { + fun o(): String + + val k: String +} + +fun f1(x: C1) = x.o() +fun f2(x: I1) = x.k + +// MODULE: platform()()(common) +// FILE: platform.kt + +actual open class C1 { + actual fun o() = "O" + + actual val k = "K" +} + +actual interface I1 { + actual fun o(): String + + actual val k: String +} + +fun box() = f1(C()) + f2(C()) \ No newline at end of file diff --git a/compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt b/compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt new file mode 100644 index 00000000000..e0034bf28f2 --- /dev/null +++ b/compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt @@ -0,0 +1,35 @@ +// IGNORE_BACKEND_K1: JS, JS_IR, JS_IR_ES6, NATIVE +// !LANGUAGE: +MultiPlatformProjects + +// MODULE: common +// TARGET_PLATFORM: Common +// FILE: common.kt + +expect interface S1 +expect interface S2 + +expect interface S : S1, S2 + +open class A : S + +class B : A() + +// MODULE: platform()()(common) +// FILE: platform.kt + +actual interface S1 { + fun s1() = "O" +} + +interface S20 { + fun s2() = "K" +} + +actual interface S2 : S20 { +} + +actual interface S : S1, S2 { + fun s3() = s1() + s2() +} + +fun box() = B().s3() \ No newline at end of file diff --git a/compiler/testData/codegen/box/multiplatform/k2/basic/interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt b/compiler/testData/codegen/box/multiplatform/k2/basic/interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt new file mode 100644 index 00000000000..6d36f168e77 --- /dev/null +++ b/compiler/testData/codegen/box/multiplatform/k2/basic/interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt @@ -0,0 +1,17 @@ +// IGNORE_BACKEND_K1: JS, JS_IR, JS_IR_ES6, NATIVE +// !LANGUAGE: +MultiPlatformProjects + +// MODULE: common +// TARGET_PLATFORM: Common +// FILE: common.kt + +interface I { fun ok(): String } +expect open class Base() { fun ok(): String } +class Child: Base(), I {} + +fun box() = Base().ok() + +// MODULE: platform()()(common) +// FILE: platform.kt + +actual open class Base { actual fun ok() = "OK" } \ No newline at end of file diff --git a/compiler/testData/codegen/box/multiplatform/k2/basic/overridesOfExpectMembers.kt b/compiler/testData/codegen/box/multiplatform/k2/basic/overridesOfExpectMembers.kt new file mode 100644 index 00000000000..c4d320e7e32 --- /dev/null +++ b/compiler/testData/codegen/box/multiplatform/k2/basic/overridesOfExpectMembers.kt @@ -0,0 +1,30 @@ +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE +// !LANGUAGE: +MultiPlatformProjects + +// MODULE: common +// FILE: common.kt + +class C2 : C1() { + override fun o() = super.o() + + override val k = "K" +} + +expect open class C1() { + open fun o(): String + + open val k: String +} + +fun foo(c2: C2) = c2.o() + c2.k + +// MODULE: platform()()(common) +// FILE: platform.kt + +actual open class C1 { + actual open fun o() = "O" + + actual open val k = "K" +} + +fun box() = foo(C2()) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/multiplatform/kt58153.kt b/compiler/testData/diagnostics/tests/multiplatform/kt58153.kt new file mode 100644 index 00000000000..3cbcf0b439b --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/kt58153.kt @@ -0,0 +1,18 @@ +// FIR_IDENTICAL +// ISSUE: KT-58153 + +// MODULE: m1-common +// FILE: common.kt + +expect open class LockFreeLinkedListNode() + +class NodeList: LockFreeLinkedListNode() { + override fun toString(): String = "" +} + +// MODULE: m2-jvm()()(m1-common) +// FILE: platform.kt + +actual open class LockFreeLinkedListNode { + override fun toString(): String = "" +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/multiplatform/manyImplMemberNotImplemented.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/manyImplMemberNotImplemented.fir.kt new file mode 100644 index 00000000000..091e3a88eb1 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/manyImplMemberNotImplemented.fir.kt @@ -0,0 +1,38 @@ +// TARGET_BACKEND: JVM +// !LANGUAGE: +MultiPlatformProjects + +// MODULE: common +// TARGET_PLATFORM: Common +// FILE: common.kt + +expect open class C1() +expect interface I1 + +open class A : C1(), I1 +open class B : I1, C1() + +expect abstract class C2() +expect interface I2 + +// TODO: KT-58829 +class C : C2(), I2 + +// MODULE: jvm()()(common) +// TARGET_PLATFORM: JVM +// FILE: main.kt + +actual open class C1 { + fun f() {} +} + +actual interface I1 { + fun f() {} +} + +actual abstract class C2 actual constructor() { + fun g() {} +} + +actual interface I2 { + fun g() +} diff --git a/compiler/testData/diagnostics/tests/multiplatform/manyImplMemberNotImplemented.kt b/compiler/testData/diagnostics/tests/multiplatform/manyImplMemberNotImplemented.kt new file mode 100644 index 00000000000..93f11e84637 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/manyImplMemberNotImplemented.kt @@ -0,0 +1,38 @@ +// TARGET_BACKEND: JVM +// !LANGUAGE: +MultiPlatformProjects + +// MODULE: common +// TARGET_PLATFORM: Common +// FILE: common.kt + +expect open class C1() +expect interface I1 + +open class A : C1(), I1 +open class B : I1, C1() + +expect abstract class C2() +expect interface I2 + +// TODO: KT-58829 +class C : C2(), I2 + +// MODULE: jvm()()(common) +// TARGET_PLATFORM: JVM +// FILE: main.kt + +actual open class C1 { + fun f() {} +} + +actual interface I1 { + fun f() {} +} + +actual abstract class C2 actual constructor() { + fun g() {} +} + +actual interface I2 { + fun g() +} diff --git a/compiler/testData/diagnostics/tests/multiplatform/multipleExpectInterfacesImplementation.kt b/compiler/testData/diagnostics/tests/multiplatform/multipleExpectInterfacesImplementation.kt new file mode 100644 index 00000000000..bd4ddf3fbd3 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/multipleExpectInterfacesImplementation.kt @@ -0,0 +1,34 @@ +// FIR_IDENTICAL +// ISSUE: KT-57833 + +// MODULE: m1-common +// FILE: common.kt + +interface ByteChannel : ByteReadChannel, ByteWriteChannel + +expect interface ByteReadChannel { + val isClosedForWrite: Boolean + + fun f() +} + +expect interface ByteWriteChannel { + val isClosedForWrite: Boolean + + fun f() +} + +// MODULE: m2-jvm()()(m1-common) +// FILE: platform.kt + +actual interface ByteReadChannel { + actual val isClosedForWrite: Boolean + + actual fun f() +} + +actual interface ByteWriteChannel { + actual val isClosedForWrite: Boolean + + actual fun f() +} \ No newline at end of file diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index b9a4a80cd41..d08275afd74 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -22324,6 +22324,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/multiplatform/kt54827.kt"); } + @Test + @TestMetadata("kt58153.kt") + public void testKt58153() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/kt58153.kt"); + } + + @Test + @TestMetadata("manyImplMemberNotImplemented.kt") + public void testManyImplMemberNotImplemented() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/manyImplMemberNotImplemented.kt"); + } + @Test @TestMetadata("manyInterfacesMemberNotImplemented.kt") public void testManyInterfacesMemberNotImplemented() throws Exception { @@ -22336,6 +22348,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/multiplatform/modifierApplicability.kt"); } + @Test + @TestMetadata("multipleExpectInterfacesImplementation.kt") + public void testMultipleExpectInterfacesImplementation() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/multipleExpectInterfacesImplementation.kt"); + } + @Test @TestMetadata("namedArguments.kt") public void testNamedArguments() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index 0f12499cd31..dda8fc6fd13 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -31863,6 +31863,42 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides.kt"); } + @Test + @TestMetadata("expectActualFakeOverrides2.kt") + public void testExpectActualFakeOverrides2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides2.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverrides3.kt") + public void testExpectActualFakeOverrides3() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides3.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters.kt") + public void testExpectActualFakeOverridesWithTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters2.kt") + public void testExpectActualFakeOverridesWithTypeParameters2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters2.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride.kt") + public void testExpectActualIntersectionOverride() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride2.kt") + public void testExpectActualIntersectionOverride2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride2.kt"); + } + @Test @TestMetadata("expectActualMultiCommon.kt") public void testExpectActualMultiCommon() throws Exception { @@ -31905,6 +31941,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes.kt"); } + @Test + @TestMetadata("expectInterfaceInSupertypes2.kt") + public void testExpectInterfaceInSupertypes2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt"); + } + @Test @TestMetadata("expectProperty.kt") public void testExpectProperty() throws Exception { @@ -31929,6 +31971,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/independentCommonSourceModules.kt"); } + @Test + @TestMetadata("interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt") + public void testInterfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt"); + } + @Test @TestMetadata("kt-56329.kt") public void testKt_56329() throws Exception { @@ -31947,6 +31995,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/nonExternalEquals.kt"); } + @Test + @TestMetadata("overridesOfExpectMembers.kt") + public void testOverridesOfExpectMembers() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/overridesOfExpectMembers.kt"); + } + @Test @TestMetadata("removeExpectDeclarationsFromMetadata.kt") public void testRemoveExpectDeclarationsFromMetadata() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index adb06b1d2ee..85d6153ea55 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -33351,6 +33351,42 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides.kt"); } + @Test + @TestMetadata("expectActualFakeOverrides2.kt") + public void testExpectActualFakeOverrides2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides2.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverrides3.kt") + public void testExpectActualFakeOverrides3() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides3.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters.kt") + public void testExpectActualFakeOverridesWithTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters2.kt") + public void testExpectActualFakeOverridesWithTypeParameters2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters2.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride.kt") + public void testExpectActualIntersectionOverride() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride2.kt") + public void testExpectActualIntersectionOverride2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride2.kt"); + } + @Test @TestMetadata("expectActualMultiCommon.kt") public void testExpectActualMultiCommon() throws Exception { @@ -33399,6 +33435,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes.kt"); } + @Test + @TestMetadata("expectInterfaceInSupertypes2.kt") + public void testExpectInterfaceInSupertypes2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt"); + } + @Test @TestMetadata("expectProperty.kt") public void testExpectProperty() throws Exception { @@ -33423,6 +33465,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/multiplatform/k2/basic/independentCommonSourceModules.kt"); } + @Test + @TestMetadata("interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt") + public void testInterfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt"); + } + @Test @TestMetadata("kt-51753-1.kt") public void testKt_51753_1() throws Exception { @@ -33453,6 +33501,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/multiplatform/k2/basic/nonExternalEquals.kt"); } + @Test + @TestMetadata("overridesOfExpectMembers.kt") + public void testOverridesOfExpectMembers() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/overridesOfExpectMembers.kt"); + } + @Test @TestMetadata("removeExpectDeclarationsFromMetadata.kt") public void testRemoveExpectDeclarationsFromMetadata() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java index 94240c5b413..2e6a1dfad2a 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java @@ -33351,6 +33351,42 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides.kt"); } + @Test + @TestMetadata("expectActualFakeOverrides2.kt") + public void testExpectActualFakeOverrides2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides2.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverrides3.kt") + public void testExpectActualFakeOverrides3() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides3.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters.kt") + public void testExpectActualFakeOverridesWithTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters2.kt") + public void testExpectActualFakeOverridesWithTypeParameters2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters2.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride.kt") + public void testExpectActualIntersectionOverride() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride2.kt") + public void testExpectActualIntersectionOverride2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride2.kt"); + } + @Test @TestMetadata("expectActualMultiCommon.kt") public void testExpectActualMultiCommon() throws Exception { @@ -33399,6 +33435,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes.kt"); } + @Test + @TestMetadata("expectInterfaceInSupertypes2.kt") + public void testExpectInterfaceInSupertypes2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt"); + } + @Test @TestMetadata("expectProperty.kt") public void testExpectProperty() throws Exception { @@ -33423,6 +33465,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack runTest("compiler/testData/codegen/box/multiplatform/k2/basic/independentCommonSourceModules.kt"); } + @Test + @TestMetadata("interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt") + public void testInterfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt"); + } + @Test @TestMetadata("kt-51753-1.kt") public void testKt_51753_1() throws Exception { @@ -33453,6 +33501,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack runTest("compiler/testData/codegen/box/multiplatform/k2/basic/nonExternalEquals.kt"); } + @Test + @TestMetadata("overridesOfExpectMembers.kt") + public void testOverridesOfExpectMembers() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/overridesOfExpectMembers.kt"); + } + @Test @TestMetadata("removeExpectDeclarationsFromMetadata.kt") public void testRemoveExpectDeclarationsFromMetadata() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 0d95159e5f0..74b7242b69b 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -27112,6 +27112,36 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class Basic extends AbstractLightAnalysisModeTest { + @TestMetadata("expectActualFakeOverrides2.kt") + public void ignoreExpectActualFakeOverrides2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides2.kt"); + } + + @TestMetadata("expectActualFakeOverrides3.kt") + public void ignoreExpectActualFakeOverrides3() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides3.kt"); + } + + @TestMetadata("expectActualFakeOverridesWithTypeParameters.kt") + public void ignoreExpectActualFakeOverridesWithTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters.kt"); + } + + @TestMetadata("expectActualFakeOverridesWithTypeParameters2.kt") + public void ignoreExpectActualFakeOverridesWithTypeParameters2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters2.kt"); + } + + @TestMetadata("expectActualIntersectionOverride.kt") + public void ignoreExpectActualIntersectionOverride() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride.kt"); + } + + @TestMetadata("expectActualIntersectionOverride2.kt") + public void ignoreExpectActualIntersectionOverride2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride2.kt"); + } + @TestMetadata("expectActualNullabilityBasedOverloads.kt") public void ignoreExpectActualNullabilityBasedOverloads() throws Exception { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualNullabilityBasedOverloads.kt"); @@ -27127,6 +27157,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/multiplatform/k2/basic/noArgActualConstructor.kt"); } + @TestMetadata("overridesOfExpectMembers.kt") + public void ignoreOverridesOfExpectMembers() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/overridesOfExpectMembers.kt"); + } + @TestMetadata("removeExpectDeclarationsFromMetadata.kt") public void ignoreRemoveExpectDeclarationsFromMetadata() throws Exception { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/removeExpectDeclarationsFromMetadata.kt"); @@ -27215,6 +27250,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes.kt"); } + @TestMetadata("expectInterfaceInSupertypes2.kt") + public void testExpectInterfaceInSupertypes2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt"); + } + @TestMetadata("fakeOverridesInPlatformModule.kt") public void testFakeOverridesInPlatformModule() throws Exception { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/fakeOverridesInPlatformModule.kt"); @@ -27230,6 +27270,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/multiplatform/k2/basic/independentCommonSourceModules.kt"); } + @TestMetadata("interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt") + public void testInterfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt"); + } + @TestMetadata("kt-56329.kt") public void testKt_56329() throws Exception { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/kt-56329.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java index 3ac9f8092fe..f0eab41cc25 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java @@ -23259,6 +23259,42 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides.kt"); } + @Test + @TestMetadata("expectActualFakeOverrides2.kt") + public void testExpectActualFakeOverrides2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides2.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverrides3.kt") + public void testExpectActualFakeOverrides3() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides3.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters.kt") + public void testExpectActualFakeOverridesWithTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters2.kt") + public void testExpectActualFakeOverridesWithTypeParameters2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters2.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride.kt") + public void testExpectActualIntersectionOverride() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride2.kt") + public void testExpectActualIntersectionOverride2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride2.kt"); + } + @Test @TestMetadata("expectActualMultiCommon.kt") public void testExpectActualMultiCommon() throws Exception { @@ -23301,6 +23337,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes.kt"); } + @Test + @TestMetadata("expectInterfaceInSupertypes2.kt") + public void testExpectInterfaceInSupertypes2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt"); + } + @Test @TestMetadata("expectProperty.kt") public void testExpectProperty() throws Exception { @@ -23319,6 +23361,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/independentCommonSourceModules.kt"); } + @Test + @TestMetadata("interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt") + public void testInterfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt"); + } + @Test @TestMetadata("kt-56329.kt") public void testKt_56329() throws Exception { @@ -23331,6 +23379,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/nonExternalEquals.kt"); } + @Test + @TestMetadata("overridesOfExpectMembers.kt") + public void testOverridesOfExpectMembers() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/overridesOfExpectMembers.kt"); + } + @Test @TestMetadata("removeExpectDeclarationsFromMetadata.kt") public void testRemoveExpectDeclarationsFromMetadata() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java index 5fc27982d99..79120e71ddb 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java @@ -23409,6 +23409,42 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides.kt"); } + @Test + @TestMetadata("expectActualFakeOverrides2.kt") + public void testExpectActualFakeOverrides2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides2.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverrides3.kt") + public void testExpectActualFakeOverrides3() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides3.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters.kt") + public void testExpectActualFakeOverridesWithTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters2.kt") + public void testExpectActualFakeOverridesWithTypeParameters2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters2.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride.kt") + public void testExpectActualIntersectionOverride() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride2.kt") + public void testExpectActualIntersectionOverride2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride2.kt"); + } + @Test @TestMetadata("expectActualMultiCommon.kt") public void testExpectActualMultiCommon() throws Exception { @@ -23451,6 +23487,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes.kt"); } + @Test + @TestMetadata("expectInterfaceInSupertypes2.kt") + public void testExpectInterfaceInSupertypes2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt"); + } + @Test @TestMetadata("expectProperty.kt") public void testExpectProperty() throws Exception { @@ -23469,6 +23511,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/independentCommonSourceModules.kt"); } + @Test + @TestMetadata("interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt") + public void testInterfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt"); + } + @Test @TestMetadata("kt-56329.kt") public void testKt_56329() throws Exception { @@ -23481,6 +23529,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/nonExternalEquals.kt"); } + @Test + @TestMetadata("overridesOfExpectMembers.kt") + public void testOverridesOfExpectMembers() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/overridesOfExpectMembers.kt"); + } + @Test @TestMetadata("removeExpectDeclarationsFromMetadata.kt") public void testRemoveExpectDeclarationsFromMetadata() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java index 2fa0b870d7f..61afec7a3ee 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java @@ -23409,6 +23409,42 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides.kt"); } + @Test + @TestMetadata("expectActualFakeOverrides2.kt") + public void testExpectActualFakeOverrides2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides2.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverrides3.kt") + public void testExpectActualFakeOverrides3() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides3.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters.kt") + public void testExpectActualFakeOverridesWithTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters2.kt") + public void testExpectActualFakeOverridesWithTypeParameters2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters2.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride.kt") + public void testExpectActualIntersectionOverride() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride2.kt") + public void testExpectActualIntersectionOverride2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride2.kt"); + } + @Test @TestMetadata("expectActualMultiCommon.kt") public void testExpectActualMultiCommon() throws Exception { @@ -23451,6 +23487,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes.kt"); } + @Test + @TestMetadata("expectInterfaceInSupertypes2.kt") + public void testExpectInterfaceInSupertypes2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt"); + } + @Test @TestMetadata("expectProperty.kt") public void testExpectProperty() throws Exception { @@ -23469,6 +23511,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/independentCommonSourceModules.kt"); } + @Test + @TestMetadata("interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt") + public void testInterfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt"); + } + @Test @TestMetadata("kt-56329.kt") public void testKt_56329() throws Exception { @@ -23481,6 +23529,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/nonExternalEquals.kt"); } + @Test + @TestMetadata("overridesOfExpectMembers.kt") + public void testOverridesOfExpectMembers() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/overridesOfExpectMembers.kt"); + } + @Test @TestMetadata("removeExpectDeclarationsFromMetadata.kt") public void testRemoveExpectDeclarationsFromMetadata() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java index 49e75eb0a7b..087dc651639 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java @@ -23409,6 +23409,42 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides.kt"); } + @Test + @TestMetadata("expectActualFakeOverrides2.kt") + public void testExpectActualFakeOverrides2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides2.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverrides3.kt") + public void testExpectActualFakeOverrides3() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides3.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters.kt") + public void testExpectActualFakeOverridesWithTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters2.kt") + public void testExpectActualFakeOverridesWithTypeParameters2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters2.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride.kt") + public void testExpectActualIntersectionOverride() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride2.kt") + public void testExpectActualIntersectionOverride2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride2.kt"); + } + @Test @TestMetadata("expectActualMultiCommon.kt") public void testExpectActualMultiCommon() throws Exception { @@ -23451,6 +23487,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes.kt"); } + @Test + @TestMetadata("expectInterfaceInSupertypes2.kt") + public void testExpectInterfaceInSupertypes2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt"); + } + @Test @TestMetadata("expectProperty.kt") public void testExpectProperty() throws Exception { @@ -23469,6 +23511,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes runTest("compiler/testData/codegen/box/multiplatform/k2/basic/independentCommonSourceModules.kt"); } + @Test + @TestMetadata("interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt") + public void testInterfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt"); + } + @Test @TestMetadata("kt-56329.kt") public void testKt_56329() throws Exception { @@ -23481,6 +23529,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes runTest("compiler/testData/codegen/box/multiplatform/k2/basic/nonExternalEquals.kt"); } + @Test + @TestMetadata("overridesOfExpectMembers.kt") + public void testOverridesOfExpectMembers() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/overridesOfExpectMembers.kt"); + } + @Test @TestMetadata("removeExpectDeclarationsFromMetadata.kt") public void testRemoveExpectDeclarationsFromMetadata() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java index b4d0a0521fe..9c89999c667 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java @@ -26499,6 +26499,42 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides.kt"); } + @Test + @TestMetadata("expectActualFakeOverrides2.kt") + public void testExpectActualFakeOverrides2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides2.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverrides3.kt") + public void testExpectActualFakeOverrides3() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides3.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters.kt") + public void testExpectActualFakeOverridesWithTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters2.kt") + public void testExpectActualFakeOverridesWithTypeParameters2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters2.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride.kt") + public void testExpectActualIntersectionOverride() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride2.kt") + public void testExpectActualIntersectionOverride2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride2.kt"); + } + @Test @TestMetadata("expectActualMultiCommon.kt") public void testExpectActualMultiCommon() throws Exception { @@ -26547,6 +26583,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes.kt"); } + @Test + @TestMetadata("expectInterfaceInSupertypes2.kt") + public void testExpectInterfaceInSupertypes2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt"); + } + @Test @TestMetadata("expectProperty.kt") public void testExpectProperty() throws Exception { @@ -26565,6 +26607,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe runTest("compiler/testData/codegen/box/multiplatform/k2/basic/independentCommonSourceModules.kt"); } + @Test + @TestMetadata("interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt") + public void testInterfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt"); + } + @Test @TestMetadata("kt-56329.kt") public void testKt_56329() throws Exception { @@ -26577,6 +26625,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe runTest("compiler/testData/codegen/box/multiplatform/k2/basic/nonExternalEquals.kt"); } + @Test + @TestMetadata("overridesOfExpectMembers.kt") + public void testOverridesOfExpectMembers() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/overridesOfExpectMembers.kt"); + } + @Test @TestMetadata("removeExpectDeclarationsFromMetadata.kt") public void testRemoveExpectDeclarationsFromMetadata() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java index c641e967b45..a419212596b 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java @@ -27105,6 +27105,42 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides.kt"); } + @Test + @TestMetadata("expectActualFakeOverrides2.kt") + public void testExpectActualFakeOverrides2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides2.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverrides3.kt") + public void testExpectActualFakeOverrides3() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides3.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters.kt") + public void testExpectActualFakeOverridesWithTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters2.kt") + public void testExpectActualFakeOverridesWithTypeParameters2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters2.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride.kt") + public void testExpectActualIntersectionOverride() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride2.kt") + public void testExpectActualIntersectionOverride2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride2.kt"); + } + @Test @TestMetadata("expectActualMultiCommon.kt") public void testExpectActualMultiCommon() throws Exception { @@ -27153,6 +27189,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes.kt"); } + @Test + @TestMetadata("expectInterfaceInSupertypes2.kt") + public void testExpectInterfaceInSupertypes2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt"); + } + @Test @TestMetadata("expectProperty.kt") public void testExpectProperty() throws Exception { @@ -27171,6 +27213,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB runTest("compiler/testData/codegen/box/multiplatform/k2/basic/independentCommonSourceModules.kt"); } + @Test + @TestMetadata("interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt") + public void testInterfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt"); + } + @Test @TestMetadata("kt-56329.kt") public void testKt_56329() throws Exception { @@ -27183,6 +27231,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB runTest("compiler/testData/codegen/box/multiplatform/k2/basic/nonExternalEquals.kt"); } + @Test + @TestMetadata("overridesOfExpectMembers.kt") + public void testOverridesOfExpectMembers() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/overridesOfExpectMembers.kt"); + } + @Test @TestMetadata("removeExpectDeclarationsFromMetadata.kt") public void testRemoveExpectDeclarationsFromMetadata() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java index 6d4a9bc5998..e72c4781b8c 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java @@ -26197,6 +26197,42 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides.kt"); } + @Test + @TestMetadata("expectActualFakeOverrides2.kt") + public void testExpectActualFakeOverrides2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides2.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverrides3.kt") + public void testExpectActualFakeOverrides3() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides3.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters.kt") + public void testExpectActualFakeOverridesWithTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters2.kt") + public void testExpectActualFakeOverridesWithTypeParameters2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters2.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride.kt") + public void testExpectActualIntersectionOverride() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride2.kt") + public void testExpectActualIntersectionOverride2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride2.kt"); + } + @Test @TestMetadata("expectActualMultiCommon.kt") public void testExpectActualMultiCommon() throws Exception { @@ -26245,6 +26281,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes.kt"); } + @Test + @TestMetadata("expectInterfaceInSupertypes2.kt") + public void testExpectInterfaceInSupertypes2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt"); + } + @Test @TestMetadata("expectProperty.kt") public void testExpectProperty() throws Exception { @@ -26263,6 +26305,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest runTest("compiler/testData/codegen/box/multiplatform/k2/basic/independentCommonSourceModules.kt"); } + @Test + @TestMetadata("interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt") + public void testInterfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt"); + } + @Test @TestMetadata("kt-56329.kt") public void testKt_56329() throws Exception { @@ -26275,6 +26323,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest runTest("compiler/testData/codegen/box/multiplatform/k2/basic/nonExternalEquals.kt"); } + @Test + @TestMetadata("overridesOfExpectMembers.kt") + public void testOverridesOfExpectMembers() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/overridesOfExpectMembers.kt"); + } + @Test @TestMetadata("removeExpectDeclarationsFromMetadata.kt") public void testRemoveExpectDeclarationsFromMetadata() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java index f130e5bff3d..f40ba04d2b0 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java @@ -26500,6 +26500,42 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides.kt"); } + @Test + @TestMetadata("expectActualFakeOverrides2.kt") + public void testExpectActualFakeOverrides2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides2.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverrides3.kt") + public void testExpectActualFakeOverrides3() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides3.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters.kt") + public void testExpectActualFakeOverridesWithTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters.kt"); + } + + @Test + @TestMetadata("expectActualFakeOverridesWithTypeParameters2.kt") + public void testExpectActualFakeOverridesWithTypeParameters2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters2.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride.kt") + public void testExpectActualIntersectionOverride() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride.kt"); + } + + @Test + @TestMetadata("expectActualIntersectionOverride2.kt") + public void testExpectActualIntersectionOverride2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride2.kt"); + } + @Test @TestMetadata("expectActualMultiCommon.kt") public void testExpectActualMultiCommon() throws Exception { @@ -26548,6 +26584,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes.kt"); } + @Test + @TestMetadata("expectInterfaceInSupertypes2.kt") + public void testExpectInterfaceInSupertypes2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt"); + } + @Test @TestMetadata("expectProperty.kt") public void testExpectProperty() throws Exception { @@ -26566,6 +26608,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT runTest("compiler/testData/codegen/box/multiplatform/k2/basic/independentCommonSourceModules.kt"); } + @Test + @TestMetadata("interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt") + public void testInterfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt"); + } + @Test @TestMetadata("kt-56329.kt") public void testKt_56329() throws Exception { @@ -26578,6 +26626,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT runTest("compiler/testData/codegen/box/multiplatform/k2/basic/nonExternalEquals.kt"); } + @Test + @TestMetadata("overridesOfExpectMembers.kt") + public void testOverridesOfExpectMembers() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/overridesOfExpectMembers.kt"); + } + @Test @TestMetadata("removeExpectDeclarationsFromMetadata.kt") public void testRemoveExpectDeclarationsFromMetadata() throws Exception { diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java index cbbe475da7b..38d61f00010 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java @@ -20818,6 +20818,36 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides.kt"); } + @TestMetadata("expectActualFakeOverrides2.kt") + public void testExpectActualFakeOverrides2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides2.kt"); + } + + @TestMetadata("expectActualFakeOverrides3.kt") + public void testExpectActualFakeOverrides3() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverrides3.kt"); + } + + @TestMetadata("expectActualFakeOverridesWithTypeParameters.kt") + public void testExpectActualFakeOverridesWithTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters.kt"); + } + + @TestMetadata("expectActualFakeOverridesWithTypeParameters2.kt") + public void testExpectActualFakeOverridesWithTypeParameters2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualFakeOverridesWithTypeParameters2.kt"); + } + + @TestMetadata("expectActualIntersectionOverride.kt") + public void testExpectActualIntersectionOverride() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride.kt"); + } + + @TestMetadata("expectActualIntersectionOverride2.kt") + public void testExpectActualIntersectionOverride2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualIntersectionOverride2.kt"); + } + @TestMetadata("expectActualMultiCommon.kt") public void testExpectActualMultiCommon() throws Exception { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectActualMultiCommon.kt"); @@ -20853,6 +20883,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes.kt"); } + @TestMetadata("expectInterfaceInSupertypes2.kt") + public void testExpectInterfaceInSupertypes2() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt"); + } + @TestMetadata("expectProperty.kt") public void testExpectProperty() throws Exception { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/expectProperty.kt"); @@ -20868,6 +20903,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/multiplatform/k2/basic/independentCommonSourceModules.kt"); } + @TestMetadata("interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt") + public void testInterfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/interfaceMethodFromSuperTypeIsImplementedInOtherExpectSuperClass.kt"); + } + @TestMetadata("kt-56329.kt") public void testKt_56329() throws Exception { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/kt-56329.kt"); @@ -20878,6 +20918,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/multiplatform/k2/basic/nonExternalEquals.kt"); } + @TestMetadata("overridesOfExpectMembers.kt") + public void testOverridesOfExpectMembers() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/k2/basic/overridesOfExpectMembers.kt"); + } + @TestMetadata("removeExpectDeclarationsFromMetadata.kt") public void testRemoveExpectDeclarationsFromMetadata() throws Exception { runTest("compiler/testData/codegen/box/multiplatform/k2/basic/removeExpectDeclarationsFromMetadata.kt");