diff --git a/native/commonizer-api/src/org/jetbrains/kotlin/commonizer/Commonizer.kt b/native/commonizer-api/src/org/jetbrains/kotlin/commonizer/Commonizer.kt index fec337d0b42..25b2191f9af 100644 --- a/native/commonizer-api/src/org/jetbrains/kotlin/commonizer/Commonizer.kt +++ b/native/commonizer-api/src/org/jetbrains/kotlin/commonizer/Commonizer.kt @@ -7,7 +7,6 @@ package org.jetbrains.kotlin.commonizer import java.io.File import java.io.Serializable -import kotlin.jvm.Throws public interface Commonizer : Serializable { @Throws(Throwable::class) diff --git a/native/commonizer/README.md b/native/commonizer/README.md index ba5c59ce09d..cb83950936e 100644 --- a/native/commonizer/README.md +++ b/native/commonizer/README.md @@ -1,8 +1,13 @@ # KLIB Commonizer -You can use platform-dependent libraries, such as `Foundation`, `UIKit`, `posix`, in source sets shared among several native targets. For each project that has native source sets that depend on a shared _native_ source set, the special tool KLIB Commonizer automatically produces: -* One library in the KLIB format (`*.klib`) with the common API of the library that includes declarations that are identical among all platforms and `expect` declarations for the APIs that differ from platform to platform. -* One KLIB for each platform-specific source set that contains the `actual` declarations and the declarations that are available only on this particular platform. +You can use platform-dependent libraries, such as `Foundation`, `UIKit`, `posix`, in source sets shared among several native targets. For +each project that has native source sets that depend on a shared _native_ source set, the special tool KLIB Commonizer automatically +produces: + +* One library in the KLIB format (`*.klib`) with the common API of the library that includes declarations that are identical among all + platforms and `expect` declarations for the APIs that differ from platform to platform. +* One KLIB for each platform-specific source set that contains the `actual` declarations and the declarations that are available only on + this particular platform. ``` commonMain @@ -25,8 +30,12 @@ Foundation (ios_arm64) Foundation (ios_x64) The resulting KLIBs are automatically added to the dependencies of the corresponding shared native and platform-specific source sets. There are few limitations in the current version of KLIB Commonizer: + * It supports only interop libraries shipped with Kotlin/Native. It doesn't support KLIBs that are produced from C-interop or Kotlin code. -* It works only for a native source set that is shared among platform-specific source sets and these source sets themselves. It doesn't work for native source sets shared at higher levels of the source set hierarchy. For example, if you have `nativeDarwinMain` that includes `iosMain` with `iosArm64Main` and `iosX64Main`, and `watchosDeviceMain` with `watchosArm64Main` and `watchosArm32Main`, the KLIB Commonizer will work separately for `iosMain` and `watchosDeviceMain` and won't work for `nativeDarwinMain`. +* It works only for a native source set that is shared among platform-specific source sets and these source sets themselves. It doesn't work + for native source sets shared at higher levels of the source set hierarchy. For example, if you have `nativeDarwinMain` that + includes `iosMain` with `iosArm64Main` and `iosX64Main`, and `watchosDeviceMain` with `watchosArm64Main` and `watchosArm32Main`, the KLIB + Commonizer will work separately for `iosMain` and `watchosDeviceMain` and won't work for `nativeDarwinMain`. ``` commonMain | @@ -40,12 +49,16 @@ There are few limitations in the current version of KLIB Commonizer: iosArm64Main iosX64Main ``` -* It does not process targets that are not available at the current host machine. For example, if you have a project with `nativeMain` source set that includes `macosX64Main`, `linuxX64Main` and `mingwX64Main`, and you run the KLIB Commonizer for this project on MacOS machine, then `mingwX64Main` source set will not be processed as far as `mingw_x64` target is absent in Kotlin/Native distribution for MacOS. The KLIB Commonizer will print the appropriate warning message and will work only for `macosX64Main` and `linuxX64Main` source sets. You can find the list of targets supported on various hosts here: https://kotlinlang.org/docs/reference/mpp-supported-platforms.html +* It does not process targets that are not available at the current host machine. For example, if you have a project with `nativeMain` + source set that includes `macosX64Main`, `linuxX64Main` and `mingwX64Main`, and you run the KLIB Commonizer for this project on MacOS + machine, then `mingwX64Main` source set will not be processed as far as `mingw_x64` target is absent in Kotlin/Native distribution for + MacOS. The KLIB Commonizer will print the appropriate warning message and will work only for `macosX64Main` and `linuxX64Main` source + sets. You can find the list of targets supported on various hosts here: https://kotlinlang.org/docs/reference/mpp-supported-platforms.html ``` Kotlin KLIB commonizer: Please wait while preparing libraries. [Step 1 of 1] Preparing commonized Kotlin/Native libraries for targets [macos_x64, linux_x64, mingw_x64] (137 items) Warning: No platform libraries found for target [mingw_x64]. This target will be excluded from commonization. ... ``` - In the degenerate case when all but one targets are not available at the host machine, the KLIB Commonizer is not launched. + In the degenerate case when all but one targets are not available at the host machine, the KLIB Commonizer is not launched. diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/cir/CirName.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/cir/CirName.kt index 6161fd49e49..f7b0effaf1b 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/cir/CirName.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/cir/CirName.kt @@ -5,10 +5,12 @@ package org.jetbrains.kotlin.commonizer.cir +import org.jetbrains.kotlin.commonizer.cir.CirEntityId.Companion.create import org.jetbrains.kotlin.commonizer.cir.CirName.Companion.create -import org.jetbrains.kotlin.commonizer.utils.hashCode +import org.jetbrains.kotlin.commonizer.cir.CirPackageName.Companion.create import org.jetbrains.kotlin.commonizer.utils.Interner import org.jetbrains.kotlin.commonizer.utils.appendHashCode +import org.jetbrains.kotlin.commonizer.utils.hashCode import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/cir/CirPropertySetter.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/cir/CirPropertySetter.kt index ff7e4980757..40d662c0768 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/cir/CirPropertySetter.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/cir/CirPropertySetter.kt @@ -5,9 +5,9 @@ package org.jetbrains.kotlin.commonizer.cir +import org.jetbrains.kotlin.commonizer.utils.Interner import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.descriptors.Visibility -import org.jetbrains.kotlin.commonizer.utils.Interner interface CirPropertySetter : CirDeclaration, CirPropertyAccessor, CirHasVisibility { val parameterAnnotations: List diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/cir/CirStandardTypes.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/cir/CirStandardTypes.kt index 5e01f47a734..566dfc8adfd 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/cir/CirStandardTypes.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/cir/CirStandardTypes.kt @@ -5,8 +5,8 @@ package org.jetbrains.kotlin.commonizer.cir -import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.commonizer.utils.ANY_CLASS_ID +import org.jetbrains.kotlin.descriptors.Visibilities object CirStandardTypes { val ANY: CirClassType = CirClassType.createInterned( diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/cir/CirType.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/cir/CirType.kt index a9229f70ff1..5bab59192eb 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/cir/CirType.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/cir/CirType.kt @@ -6,10 +6,10 @@ package org.jetbrains.kotlin.commonizer.cir import kotlinx.metadata.KmType -import org.jetbrains.kotlin.descriptors.Visibility import org.jetbrains.kotlin.commonizer.utils.Interner import org.jetbrains.kotlin.commonizer.utils.appendHashCode import org.jetbrains.kotlin.commonizer.utils.hashCode +import org.jetbrains.kotlin.descriptors.Visibility import org.jetbrains.kotlin.types.Variance typealias CirTypeSignature = String diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/cli/NativeTargetsOptionType.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/cli/NativeTargetsOptionType.kt index dac8d705299..007107adf4a 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/cli/NativeTargetsOptionType.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/cli/NativeTargetsOptionType.kt @@ -9,7 +9,8 @@ import org.jetbrains.kotlin.konan.target.KonanTarget import org.jetbrains.kotlin.konan.target.KonanTarget.Companion.predefinedTargets internal object NativeTargetsOptionType : OptionType>( - "targets", "Comma-separated list of hardware targets", mandatory = false) { + "targets", "Comma-separated list of hardware targets", mandatory = false +) { override fun parse(rawValue: String, onError: (reason: String) -> Nothing): Option> { val targetNames = rawValue.split(',') if (targetNames.isEmpty()) onError("No hardware targets specified: $rawValue") diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/AbstractFunctionOrPropertyCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/AbstractFunctionOrPropertyCommonizer.kt index 37fa6664ace..1ea38339da2 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/AbstractFunctionOrPropertyCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/AbstractFunctionOrPropertyCommonizer.kt @@ -5,12 +5,12 @@ package org.jetbrains.kotlin.commonizer.core -import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor -import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.DELEGATION -import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.SYNTHESIZED import org.jetbrains.kotlin.commonizer.cir.CirFunctionOrProperty import org.jetbrains.kotlin.commonizer.cir.CirName import org.jetbrains.kotlin.commonizer.mergedtree.CirKnownClassifiers +import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor +import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.DELEGATION +import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.SYNTHESIZED abstract class AbstractFunctionOrPropertyCommonizer( classifiers: CirKnownClassifiers diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/ClassCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/ClassCommonizer.kt index 0bb15c9e69d..94daab0fb65 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/ClassCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/ClassCommonizer.kt @@ -5,10 +5,10 @@ package org.jetbrains.kotlin.commonizer.core -import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.commonizer.cir.CirClass import org.jetbrains.kotlin.commonizer.cir.CirName import org.jetbrains.kotlin.commonizer.mergedtree.CirKnownClassifiers +import org.jetbrains.kotlin.descriptors.ClassKind class ClassCommonizer(classifiers: CirKnownClassifiers) : AbstractStandardCommonizer() { private lateinit var name: CirName diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/ClassConstructorCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/ClassConstructorCommonizer.kt index 6fbc73be407..d0e74448f61 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/ClassConstructorCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/ClassConstructorCommonizer.kt @@ -5,11 +5,11 @@ package org.jetbrains.kotlin.commonizer.core -import org.jetbrains.kotlin.descriptors.ClassKind -import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.commonizer.cir.CirClassConstructor import org.jetbrains.kotlin.commonizer.cir.CirContainingClass import org.jetbrains.kotlin.commonizer.mergedtree.CirKnownClassifiers +import org.jetbrains.kotlin.descriptors.ClassKind +import org.jetbrains.kotlin.descriptors.Modality class ClassConstructorCommonizer( classifiers: CirKnownClassifiers diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/CommonizationVisitor.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/CommonizationVisitor.kt index ed13ca40377..ff7a77a1c7f 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/CommonizationVisitor.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/CommonizationVisitor.kt @@ -8,7 +8,7 @@ package org.jetbrains.kotlin.commonizer.core import org.jetbrains.kotlin.commonizer.cir.CirClass import org.jetbrains.kotlin.commonizer.cir.CirType import org.jetbrains.kotlin.commonizer.mergedtree.* -import org.jetbrains.kotlin.commonizer.utils.* +import org.jetbrains.kotlin.commonizer.utils.CommonizedGroup import org.jetbrains.kotlin.commonizer.utils.compactMapNotNull internal class CommonizationVisitor( diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/PropertySetterCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/PropertySetterCommonizer.kt index 60a11c57450..6bedaf2274f 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/PropertySetterCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/PropertySetterCommonizer.kt @@ -5,9 +5,9 @@ package org.jetbrains.kotlin.commonizer.core -import org.jetbrains.kotlin.descriptors.Visibility import org.jetbrains.kotlin.commonizer.cir.CirHasVisibility import org.jetbrains.kotlin.commonizer.cir.CirPropertySetter +import org.jetbrains.kotlin.descriptors.Visibility class PropertySetterCommonizer : AbstractNullableCommonizer( wrappedCommonizerFactory = { VisibilityCommonizer.equalizing() }, diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/TypeAliasCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/TypeAliasCommonizer.kt index 53c52e3cd93..632fda762f5 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/TypeAliasCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/TypeAliasCommonizer.kt @@ -5,10 +5,10 @@ package org.jetbrains.kotlin.commonizer.core -import org.jetbrains.kotlin.descriptors.ClassKind -import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.commonizer.cir.* import org.jetbrains.kotlin.commonizer.mergedtree.CirKnownClassifiers +import org.jetbrains.kotlin.descriptors.ClassKind +import org.jetbrains.kotlin.descriptors.Modality /** * Primary (optimistic) branch: diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/TypeArgumentCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/TypeArgumentCommonizer.kt index cf30fbd0e16..f6ccba77b3b 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/TypeArgumentCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/TypeArgumentCommonizer.kt @@ -5,9 +5,9 @@ package org.jetbrains.kotlin.commonizer.core +import org.jetbrains.kotlin.commonizer.cir.CirRegularTypeProjection import org.jetbrains.kotlin.commonizer.cir.CirStarTypeProjection import org.jetbrains.kotlin.commonizer.cir.CirTypeProjection -import org.jetbrains.kotlin.commonizer.cir.CirRegularTypeProjection import org.jetbrains.kotlin.commonizer.mergedtree.CirKnownClassifiers import org.jetbrains.kotlin.types.Variance diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/TypeCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/TypeCommonizer.kt index 23016725f79..d25bf9a47df 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/TypeCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/TypeCommonizer.kt @@ -5,12 +5,12 @@ package org.jetbrains.kotlin.commonizer.core -import org.jetbrains.kotlin.descriptors.Visibility import org.jetbrains.kotlin.commonizer.cir.* import org.jetbrains.kotlin.commonizer.core.CommonizedTypeAliasAnswer.Companion.FAILURE_MISSING_IN_SOME_TARGET import org.jetbrains.kotlin.commonizer.core.CommonizedTypeAliasAnswer.Companion.SUCCESS_FROM_DEPENDENCY_LIBRARY import org.jetbrains.kotlin.commonizer.mergedtree.CirKnownClassifiers import org.jetbrains.kotlin.commonizer.utils.isUnderKotlinNativeSyntheticPackages +import org.jetbrains.kotlin.descriptors.Visibility class TypeCommonizer(private val classifiers: CirKnownClassifiers) : AbstractStandardCommonizer() { private lateinit var wrapped: Commonizer<*, CirType> @@ -141,7 +141,11 @@ private class TypeAliasTypeCommonizer(private val classifiers: CirKnownClassifie // type alias don't needs to be commonized because it is from the standard library fun forKnownUnderlyingType(underlyingType: CirClassOrTypeAliasType) = object : CommonizedTypeAliasTypeBuilder { - override fun build(typeAliasId: CirEntityId, arguments: List, isMarkedNullable: Boolean): CirTypeAliasType { + override fun build( + typeAliasId: CirEntityId, + arguments: List, + isMarkedNullable: Boolean + ): CirTypeAliasType { val underlyingTypeWithProperNullability = underlyingType.makeNullableIfNecessary(isMarkedNullable) return CirTypeAliasType.createInterned( typeAliasId = typeAliasId, diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/VisibilityCommonizer.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/VisibilityCommonizer.kt index 48de4223526..71e77eba2ff 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/VisibilityCommonizer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/core/VisibilityCommonizer.kt @@ -5,10 +5,10 @@ package org.jetbrains.kotlin.commonizer.core -import org.jetbrains.kotlin.descriptors.Visibilities -import org.jetbrains.kotlin.descriptors.Visibility import org.jetbrains.kotlin.commonizer.cir.CirFunctionOrProperty import org.jetbrains.kotlin.commonizer.cir.CirHasVisibility +import org.jetbrains.kotlin.descriptors.Visibilities +import org.jetbrains.kotlin.descriptors.Visibility abstract class VisibilityCommonizer : Commonizer { diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/konan/DefaultModulesProvider.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/konan/DefaultModulesProvider.kt index 5613ad8b832..744f13f0bee 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/konan/DefaultModulesProvider.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/konan/DefaultModulesProvider.kt @@ -7,7 +7,6 @@ package org.jetbrains.kotlin.commonizer.konan import org.jetbrains.kotlin.commonizer.ModulesProvider import org.jetbrains.kotlin.commonizer.ModulesProvider.ModuleInfo -import org.jetbrains.kotlin.konan.library.KONAN_STDLIB_NAME import org.jetbrains.kotlin.library.SerializedMetadata import org.jetbrains.kotlin.library.metadata.parseModuleHeader import java.io.File diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/mergedtree/CirFictitiousFunctionClassifiers.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/mergedtree/CirFictitiousFunctionClassifiers.kt index 1c19d135506..5b1f0faceba 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/mergedtree/CirFictitiousFunctionClassifiers.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/mergedtree/CirFictitiousFunctionClassifiers.kt @@ -6,10 +6,10 @@ package org.jetbrains.kotlin.commonizer.mergedtree import gnu.trove.THashMap -import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.commonizer.cir.CirEntityId import org.jetbrains.kotlin.commonizer.cir.CirName import org.jetbrains.kotlin.commonizer.cir.CirPackageName +import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.types.Variance object CirFictitiousFunctionClassifiers : CirProvidedClassifiers { diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/mergedtree/CirProvidedClassifiersByModules.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/mergedtree/CirProvidedClassifiersByModules.kt index 6a8cc0676cd..e3fe76fcc84 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/mergedtree/CirProvidedClassifiersByModules.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/mergedtree/CirProvidedClassifiersByModules.kt @@ -7,7 +7,6 @@ package org.jetbrains.kotlin.commonizer.mergedtree import com.intellij.util.containers.FactoryMap import gnu.trove.THashMap -import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.commonizer.ModulesProvider import org.jetbrains.kotlin.commonizer.ModulesProvider.CInteropModuleAttributes import org.jetbrains.kotlin.commonizer.cir.CirEntityId @@ -17,6 +16,7 @@ import org.jetbrains.kotlin.commonizer.utils.NON_EXISTING_CLASSIFIER_ID import org.jetbrains.kotlin.commonizer.utils.compactMap import org.jetbrains.kotlin.commonizer.utils.compactMapIndexed import org.jetbrains.kotlin.commonizer.utils.isUnderKotlinNativeSyntheticPackages +import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.library.SerializedMetadata import org.jetbrains.kotlin.library.metadata.parsePackageFragment import org.jetbrains.kotlin.metadata.ProtoBuf diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/mergedtree/CirRootNode.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/mergedtree/CirRootNode.kt index f0f117e512e..13dc652a0a9 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/mergedtree/CirRootNode.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/mergedtree/CirRootNode.kt @@ -6,10 +6,8 @@ package org.jetbrains.kotlin.commonizer.mergedtree import gnu.trove.THashMap -import org.jetbrains.kotlin.commonizer.CommonizerTarget import org.jetbrains.kotlin.commonizer.cir.CirName import org.jetbrains.kotlin.commonizer.cir.CirRoot -import org.jetbrains.kotlin.commonizer.mergedtree.CirNode.Companion.indexOfCommon import org.jetbrains.kotlin.commonizer.utils.CommonizedGroup import org.jetbrains.kotlin.storage.NullableLazyValue diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/mergedtree/nodeBuilders.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/mergedtree/nodeBuilders.kt index 84da6242c9d..b8e2351049d 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/mergedtree/nodeBuilders.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/mergedtree/nodeBuilders.kt @@ -5,10 +5,10 @@ package org.jetbrains.kotlin.commonizer.mergedtree -import org.jetbrains.kotlin.commonizer.cir.CirDeclaration -import org.jetbrains.kotlin.commonizer.cir.CirEntityId import org.jetbrains.kotlin.commonizer.cir.CirClassRecursionMarker import org.jetbrains.kotlin.commonizer.cir.CirClassifierRecursionMarker +import org.jetbrains.kotlin.commonizer.cir.CirDeclaration +import org.jetbrains.kotlin.commonizer.cir.CirEntityId import org.jetbrains.kotlin.commonizer.core.* import org.jetbrains.kotlin.commonizer.utils.CommonizedGroup import org.jetbrains.kotlin.storage.NullableLazyValue diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/metadata/CirSerializers.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/metadata/CirSerializers.kt index 11c9f7e24c9..b1321ccb56b 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/metadata/CirSerializers.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/metadata/CirSerializers.kt @@ -9,7 +9,6 @@ import kotlinx.metadata.* import kotlinx.metadata.klib.* import org.jetbrains.kotlin.backend.common.serialization.metadata.DynamicTypeDeserializer import org.jetbrains.kotlin.commonizer.cir.* -import org.jetbrains.kotlin.commonizer.mergedtree.* import org.jetbrains.kotlin.commonizer.metadata.TypeAliasExpansion.* import org.jetbrains.kotlin.commonizer.utils.DEFAULT_SETTER_VALUE_NAME import org.jetbrains.kotlin.commonizer.utils.SPECIAL_CLASS_WITHOUT_SUPERTYPES_CLASS_NAMES diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/metadata/CirTreeSerializer.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/metadata/CirTreeSerializer.kt index de50ce6e569..9f2cecc2642 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/metadata/CirTreeSerializer.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/metadata/CirTreeSerializer.kt @@ -7,17 +7,16 @@ package org.jetbrains.kotlin.commonizer.metadata import kotlinx.metadata.* import kotlinx.metadata.klib.KlibModuleMetadata -import org.jetbrains.kotlin.commonizer.CommonizerTarget import org.jetbrains.kotlin.commonizer.cir.* import org.jetbrains.kotlin.commonizer.mergedtree.* import org.jetbrains.kotlin.commonizer.mergedtree.CirNode.Companion.indexOfCommon +import org.jetbrains.kotlin.commonizer.metadata.CirTreeSerializationContext.Path import org.jetbrains.kotlin.commonizer.stats.DeclarationType import org.jetbrains.kotlin.commonizer.stats.StatsCollector import org.jetbrains.kotlin.commonizer.stats.StatsCollector.StatsKey import org.jetbrains.kotlin.commonizer.utils.DEFAULT_CONSTRUCTOR_NAME -import org.jetbrains.kotlin.utils.addToStdlib.cast import org.jetbrains.kotlin.commonizer.utils.firstNonNull -import org.jetbrains.kotlin.commonizer.metadata.CirTreeSerializationContext.Path +import org.jetbrains.kotlin.utils.addToStdlib.cast object CirTreeSerializer { fun serializeSingleTarget( @@ -176,7 +175,14 @@ private class CirTreeSerializationVisitor( property } - return cirClass.serializeClass(classContext, fullClassName, directNestedClasses, nestedConstructors, nestedFunctions, nestedProperties) + return cirClass.serializeClass( + classContext, + fullClassName, + directNestedClasses, + nestedConstructors, + nestedFunctions, + nestedProperties + ) } override fun visitClassConstructorNode( diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/metadata/flags.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/metadata/flags.kt index 4a695ba2822..8727b6d58b3 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/metadata/flags.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/metadata/flags.kt @@ -8,11 +8,11 @@ package org.jetbrains.kotlin.commonizer.metadata import kotlinx.metadata.Flag import kotlinx.metadata.Flags import kotlinx.metadata.flagsOf +import org.jetbrains.kotlin.commonizer.cir.* import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.Visibilities -import org.jetbrains.kotlin.commonizer.cir.* internal const val NO_FLAGS: Flags = 0 diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/metadata/utils/MetadataDeclarationsComparator.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/metadata/utils/MetadataDeclarationsComparator.kt index c990407e984..bf8172ec74d 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/metadata/utils/MetadataDeclarationsComparator.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/metadata/utils/MetadataDeclarationsComparator.kt @@ -8,11 +8,23 @@ package org.jetbrains.kotlin.commonizer.metadata.utils import com.intellij.util.containers.FactoryMap import kotlinx.metadata.* import kotlinx.metadata.klib.* -import org.jetbrains.kotlin.commonizer.metadata.utils.MetadataDeclarationsComparator.EntityKind.AnnotationKind -import org.jetbrains.kotlin.commonizer.metadata.utils.MetadataDeclarationsComparator.EntityKind.TypeKind -import org.jetbrains.kotlin.commonizer.metadata.utils.MetadataDeclarationsComparator.EntityKind.FlagKind +import org.jetbrains.kotlin.commonizer.metadata.utils.MetadataDeclarationsComparator.EntityKind.* +import org.jetbrains.kotlin.commonizer.metadata.utils.MetadataDeclarationsComparator.Mismatch +import org.jetbrains.kotlin.commonizer.metadata.utils.MetadataDeclarationsComparator.Result import org.jetbrains.kotlin.commonizer.utils.KNI_BRIDGE_FUNCTION_PREFIX import java.util.* +import kotlin.Any +import kotlin.Array +import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.apply +import kotlin.arrayOf +import kotlin.check +import kotlin.error +import kotlin.let import kotlin.reflect.KProperty import kotlin.reflect.KProperty0 diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/repository/CommonizerDependencyRepository.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/repository/CommonizerDependencyRepository.kt index bd4c87d40e4..f0d41a0379e 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/repository/CommonizerDependencyRepository.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/repository/CommonizerDependencyRepository.kt @@ -6,7 +6,6 @@ package org.jetbrains.kotlin.commonizer.repository import org.jetbrains.kotlin.commonizer.* -import org.jetbrains.kotlin.commonizer.NativeLibraryLoader import org.jetbrains.kotlin.commonizer.konan.NativeLibrary internal class CommonizerDependencyRepository( diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/repository/KonanDistributionRepository.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/repository/KonanDistributionRepository.kt index ae67d589ba0..5e838e18413 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/repository/KonanDistributionRepository.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/repository/KonanDistributionRepository.kt @@ -6,7 +6,6 @@ package org.jetbrains.kotlin.commonizer.repository import org.jetbrains.kotlin.commonizer.* -import org.jetbrains.kotlin.commonizer.NativeLibraryLoader import org.jetbrains.kotlin.commonizer.konan.NativeLibrary import org.jetbrains.kotlin.konan.target.KonanTarget diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/stats/RawStatsCollector.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/stats/RawStatsCollector.kt index 652d4602966..78dca65d4fa 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/stats/RawStatsCollector.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/stats/RawStatsCollector.kt @@ -6,14 +6,12 @@ package org.jetbrains.kotlin.commonizer.stats import com.intellij.util.containers.FactoryMap -import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.commonizer.CommonizerTarget import org.jetbrains.kotlin.commonizer.identityString import org.jetbrains.kotlin.commonizer.stats.StatsCollector.StatsKey import org.jetbrains.kotlin.commonizer.stats.StatsOutput.StatsHeader import org.jetbrains.kotlin.commonizer.stats.StatsOutput.StatsRow import java.util.* -import kotlin.collections.ArrayList /** * Allows printing commonization statistics to the file system. diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/tree/mergeCirTree.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/tree/mergeCirTree.kt index 02936461dc6..e8298a0452c 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/tree/mergeCirTree.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/tree/mergeCirTree.kt @@ -71,7 +71,8 @@ internal fun CirNodeWithMembers<*, *>.buildFunction( } internal fun CirNodeWithMembers<*, *>.buildProperty( - context: TargetBuildingContext, treeProperty: CirTreeProperty, parent: CirNode<*, *>? = null) { + context: TargetBuildingContext, treeProperty: CirTreeProperty, parent: CirNode<*, *>? = null +) { val propertyNode = properties.getOrPut(treeProperty.approximationKey) { buildPropertyNode(context.storageManager, context.targets, context.classifiers, parent?.commonDeclaration) } diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/utils/misc.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/utils/misc.kt index be6a8eff8c4..75883478d4c 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/utils/misc.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/utils/misc.kt @@ -11,7 +11,6 @@ import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance import java.util.* import java.util.Collections.singletonList import java.util.Collections.singletonMap -import kotlin.collections.ArrayList internal inline fun Map.compactMapValues(transform: (Map.Entry) -> R): Map = when (size) { diff --git a/native/commonizer/testData/callableMemberCommonization/returnTypes/commonized/common/package_root.kt b/native/commonizer/testData/callableMemberCommonization/returnTypes/commonized/common/package_root.kt index 77e197d25b9..762073da803 100644 --- a/native/commonizer/testData/callableMemberCommonization/returnTypes/commonized/common/package_root.kt +++ b/native/commonizer/testData/callableMemberCommonization/returnTypes/commonized/common/package_root.kt @@ -26,6 +26,7 @@ expect fun function7(): C expect class Box(value: T) { val value: T } + expect class Fox() expect fun functionWithTypeParametersInReturnType1(): Array @@ -46,6 +47,7 @@ expect class Outer() { class Nested() inner class Inner() } + inner class Inner() { inner class Inner() } diff --git a/native/commonizer/testData/callableMemberCommonization/returnTypes/commonized/js/package_root.kt b/native/commonizer/testData/callableMemberCommonization/returnTypes/commonized/js/package_root.kt index caf75ba0f35..a88e812f93e 100644 --- a/native/commonizer/testData/callableMemberCommonization/returnTypes/commonized/js/package_root.kt +++ b/native/commonizer/testData/callableMemberCommonization/returnTypes/commonized/js/package_root.kt @@ -67,6 +67,7 @@ actual class Outer actual constructor() { actual class Nested actual constructor() actual inner class Inner actual constructor() } + actual inner class Inner actual constructor() { actual inner class Inner actual constructor() } diff --git a/native/commonizer/testData/callableMemberCommonization/returnTypes/commonized/jvm/package_root.kt b/native/commonizer/testData/callableMemberCommonization/returnTypes/commonized/jvm/package_root.kt index 23cc88db321..7933fb87a3b 100644 --- a/native/commonizer/testData/callableMemberCommonization/returnTypes/commonized/jvm/package_root.kt +++ b/native/commonizer/testData/callableMemberCommonization/returnTypes/commonized/jvm/package_root.kt @@ -67,6 +67,7 @@ actual class Outer actual constructor() { actual class Nested actual constructor() actual inner class Inner actual constructor() } + actual inner class Inner actual constructor() { actual inner class Inner actual constructor() } diff --git a/native/commonizer/testData/callableMemberCommonization/returnTypes/original/js/package_root.kt b/native/commonizer/testData/callableMemberCommonization/returnTypes/original/js/package_root.kt index 15237587e7f..389b802ee5b 100644 --- a/native/commonizer/testData/callableMemberCommonization/returnTypes/original/js/package_root.kt +++ b/native/commonizer/testData/callableMemberCommonization/returnTypes/original/js/package_root.kt @@ -70,6 +70,7 @@ class Outer { class Nested inner class Inner } + inner class Inner { inner class Inner } diff --git a/native/commonizer/testData/callableMemberCommonization/returnTypes/original/jvm/package_root.kt b/native/commonizer/testData/callableMemberCommonization/returnTypes/original/jvm/package_root.kt index 8fa0b2b1f3b..e556c0cdb33 100644 --- a/native/commonizer/testData/callableMemberCommonization/returnTypes/original/jvm/package_root.kt +++ b/native/commonizer/testData/callableMemberCommonization/returnTypes/original/jvm/package_root.kt @@ -70,6 +70,7 @@ class Outer { class Nested inner class Inner } + inner class Inner { inner class Inner } diff --git a/native/commonizer/testData/classifierCommonization/classKindAndModifiers/commonized/common/package_root.kt b/native/commonizer/testData/classifierCommonization/classKindAndModifiers/commonized/common/package_root.kt index 0a4355a9c9e..230ed0bd0b2 100644 --- a/native/commonizer/testData/classifierCommonization/classKindAndModifiers/commonized/common/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/classKindAndModifiers/commonized/common/package_root.kt @@ -36,10 +36,16 @@ expect class W() { } } -expect class BB1() { companion object } +expect class BB1() { + companion object +} + expect class BB2() -expect class CC1() { companion object DD1 } +expect class CC1() { + companion object DD1 +} + expect class CC2() expect class CC3() @@ -54,15 +60,16 @@ expect class FF1(property1: String) { fun function1(): String fun function2(): String } + expect class FF2() expect sealed class GG1 expect sealed class GG2 { - class HH1(): GG2 + class HH1() : GG2 object HH2 : GG2 } -expect class HH5(): GG2 +expect class HH5() : GG2 expect object HH6 : GG2 expect enum class II1 @@ -80,5 +87,10 @@ expect class KK1(property: String) : JJ { expect class KK2(wrapped: JJ) : JJ -expect class LL1(value: String) { val value: String } -expect class LL2(value: String) { val value: String } +expect class LL1(value: String) { + val value: String +} + +expect class LL2(value: String) { + val value: String +} diff --git a/native/commonizer/testData/classifierCommonization/classKindAndModifiers/commonized/js/package_root.kt b/native/commonizer/testData/classifierCommonization/classKindAndModifiers/commonized/js/package_root.kt index 74ca2b02048..e1c1b63d699 100644 --- a/native/commonizer/testData/classifierCommonization/classKindAndModifiers/commonized/js/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/classKindAndModifiers/commonized/js/package_root.kt @@ -84,12 +84,25 @@ actual class W actual constructor() { } } -actual class BB1 actual constructor() { actual companion object } -actual class BB2 actual constructor() { companion object } +actual class BB1 actual constructor() { + actual companion object +} -actual class CC1 actual constructor() { actual companion object DD1 } -actual class CC2 actual constructor() { companion object DD2 } -actual class CC3 actual constructor() { companion object DD3 } +actual class BB2 actual constructor() { + companion object +} + +actual class CC1 actual constructor() { + actual companion object DD1 +} + +actual class CC2 actual constructor() { + companion object DD2 +} + +actual class CC3 actual constructor() { + companion object DD3 +} actual inline class EE1 actual constructor(actual val value: String) inline class EE2(val value: String) @@ -102,16 +115,17 @@ actual external class FF1 actual constructor(actual val property1: String) { actual fun function1() = property1 actual fun function2(): String } + actual external class FF2 actual constructor() actual sealed class GG1 actual sealed class GG2 { - actual class HH1 actual constructor(): GG2() + actual class HH1 actual constructor() : GG2() actual object HH2 : GG2() class HH3 : GG2() } -actual class HH5 actual constructor(): GG2() +actual class HH5 actual constructor() : GG2() actual object HH6 : GG2() class HH7 : GG2() @@ -124,7 +138,7 @@ actual interface JJ { } actual class KK1 actual constructor(actual override val property: String) : JJ { - actual override fun function() = property + actual override fun function() = property } actual class KK2 actual constructor(private val wrapped: JJ) : JJ by wrapped diff --git a/native/commonizer/testData/classifierCommonization/classKindAndModifiers/commonized/jvm/package_root.kt b/native/commonizer/testData/classifierCommonization/classKindAndModifiers/commonized/jvm/package_root.kt index 422f4b8a13c..2a639539fd2 100644 --- a/native/commonizer/testData/classifierCommonization/classKindAndModifiers/commonized/jvm/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/classKindAndModifiers/commonized/jvm/package_root.kt @@ -84,12 +84,23 @@ actual class W actual constructor() { } } -actual class BB1 actual constructor() { actual companion object } +actual class BB1 actual constructor() { + actual companion object +} + actual class BB2 actual constructor() -actual class CC1 actual constructor() { actual companion object DD1 } -actual class CC2 actual constructor() { companion object CompanionWithAnotherName } -actual class CC3 actual constructor() { companion object } +actual class CC1 actual constructor() { + actual companion object DD1 +} + +actual class CC2 actual constructor() { + companion object CompanionWithAnotherName +} + +actual class CC3 actual constructor() { + companion object +} actual inline class EE1 actual constructor(actual val value: String) class EE2(val value: String) @@ -102,16 +113,17 @@ actual class FF1 actual constructor(actual val property1: String) { actual fun function1() = property1 actual fun function2() = function1() } + actual external class FF2 actual constructor() actual sealed class GG1 actual sealed class GG2 { - actual class HH1 actual constructor(): GG2() + actual class HH1 actual constructor() : GG2() actual object HH2 : GG2() class HH4 : GG2() } -actual class HH5 actual constructor(): GG2() +actual class HH5 actual constructor() : GG2() actual object HH6 : GG2() class HH8 : GG2() @@ -126,7 +138,7 @@ actual interface JJ { actual class KK1 actual constructor(actual override val property: String) : JJ { val property2 = property - actual override fun function() = property + actual override fun function() = property } actual class KK2 actual constructor(wrapped: JJ) : JJ by wrapped diff --git a/native/commonizer/testData/classifierCommonization/classKindAndModifiers/original/js/package_root.kt b/native/commonizer/testData/classifierCommonization/classKindAndModifiers/original/js/package_root.kt index 4a385b10ac6..1d54ea977a4 100644 --- a/native/commonizer/testData/classifierCommonization/classKindAndModifiers/original/js/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/classKindAndModifiers/original/js/package_root.kt @@ -84,12 +84,25 @@ class W { } } -class BB1 { companion object } -class BB2 { companion object } +class BB1 { + companion object +} -class CC1 { companion object DD1 } -class CC2 { companion object DD2 } -class CC3 { companion object DD3 } +class BB2 { + companion object +} + +class CC1 { + companion object DD1 +} + +class CC2 { + companion object DD2 +} + +class CC3 { + companion object DD3 +} inline class EE1(val value: String) inline class EE2(val value: String) @@ -102,6 +115,7 @@ external class FF1(val property1: String) { fun function1() = property1 fun function2(): String } + external class FF2() sealed class GG1 diff --git a/native/commonizer/testData/classifierCommonization/classKindAndModifiers/original/jvm/package_root.kt b/native/commonizer/testData/classifierCommonization/classKindAndModifiers/original/jvm/package_root.kt index 84c7956ab30..ba85cf5050c 100644 --- a/native/commonizer/testData/classifierCommonization/classKindAndModifiers/original/jvm/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/classKindAndModifiers/original/jvm/package_root.kt @@ -84,12 +84,23 @@ class W { } } -class BB1 { companion object } +class BB1 { + companion object +} + class BB2 -class CC1 { companion object DD1 } -class CC2 { companion object CompanionWithAnotherName } -class CC3 { companion object } +class CC1 { + companion object DD1 +} + +class CC2 { + companion object CompanionWithAnotherName +} + +class CC3 { + companion object +} inline class EE1(val value: String) class EE2(val value: String) @@ -102,6 +113,7 @@ class FF1(val property1: String) { fun function1() = property1 fun function2() = function1() } + external class FF2() sealed class GG1 diff --git a/native/commonizer/testData/classifierCommonization/constructors/commonized/common/package_root.kt b/native/commonizer/testData/classifierCommonization/constructors/commonized/common/package_root.kt index 53f2a59500f..7a036758f3f 100644 --- a/native/commonizer/testData/classifierCommonization/constructors/commonized/common/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/constructors/commonized/common/package_root.kt @@ -1,14 +1,26 @@ -expect class A1(text: String) { constructor(number: Int) } -expect class A2(text: String) { constructor(number: Int) } +expect class A1(text: String) { + constructor(number: Int) +} + +expect class A2(text: String) { + constructor(number: Int) +} + expect class A3 expect class A4 expect class A5 -expect class B1 protected constructor(text: String) { protected constructor(number: Int) } +expect class B1 protected constructor(text: String) { + protected constructor(number: Int) +} + expect class B2 expect class B3 -expect class C1 internal constructor(text: String) { internal constructor(number: Int) } +expect class C1 internal constructor(text: String) { + internal constructor(number: Int) +} + expect class C2 expect class D1 diff --git a/native/commonizer/testData/classifierCommonization/constructors/commonized/js/package_root.kt b/native/commonizer/testData/classifierCommonization/constructors/commonized/js/package_root.kt index 83acfee6d51..2b23cf12f7f 100644 --- a/native/commonizer/testData/classifierCommonization/constructors/commonized/js/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/constructors/commonized/js/package_root.kt @@ -1,17 +1,46 @@ -actual class A1 actual constructor(text: String) { actual constructor(number: Int) : this(number.toString()) } -actual class A2 actual constructor(text: String) { actual constructor(number: Int) : this(number.toString()) } -actual class A3(text: String) { constructor(number: Int) : this(number.toString()) } -actual class A4(text: String) { constructor(number: Int) : this(number.toString()) } -actual class A5(text: String) { constructor(number: Int) : this(number.toString()) } +actual class A1 actual constructor(text: String) { + actual constructor(number: Int) : this(number.toString()) +} -actual class B1 protected actual constructor(text: String) { protected actual constructor(number: Int) : this(number.toString()) } -actual class B2 protected constructor(text: String) { protected constructor(number: Int) : this(number.toString()) } -actual class B3 protected constructor(text: String) { protected constructor(number: Int) : this(number.toString()) } +actual class A2 actual constructor(text: String) { + actual constructor(number: Int) : this(number.toString()) +} -actual class C1 internal actual constructor(text: String) { internal actual constructor(number: Int) : this(number.toString()) } -actual class C2 internal constructor(text: String) { internal constructor(number: Int) : this(number.toString()) } +actual class A3(text: String) { + constructor(number: Int) : this(number.toString()) +} -actual class D1 private constructor(text: String) { private constructor(number: Int) : this(number.toString()) } +actual class A4(text: String) { + constructor(number: Int) : this(number.toString()) +} + +actual class A5(text: String) { + constructor(number: Int) : this(number.toString()) +} + +actual class B1 protected actual constructor(text: String) { + protected actual constructor(number: Int) : this(number.toString()) +} + +actual class B2 protected constructor(text: String) { + protected constructor(number: Int) : this(number.toString()) +} + +actual class B3 protected constructor(text: String) { + protected constructor(number: Int) : this(number.toString()) +} + +actual class C1 internal actual constructor(text: String) { + internal actual constructor(number: Int) : this(number.toString()) +} + +actual class C2 internal constructor(text: String) { + internal constructor(number: Int) : this(number.toString()) +} + +actual class D1 private constructor(text: String) { + private constructor(number: Int) : this(number.toString()) +} actual class E { constructor(a: Int) diff --git a/native/commonizer/testData/classifierCommonization/constructors/commonized/jvm/package_root.kt b/native/commonizer/testData/classifierCommonization/constructors/commonized/jvm/package_root.kt index 04d817a47da..d498c560dc5 100644 --- a/native/commonizer/testData/classifierCommonization/constructors/commonized/jvm/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/constructors/commonized/jvm/package_root.kt @@ -1,17 +1,46 @@ -actual class A1 actual constructor(text: String) { actual constructor(number: Int) : this(number.toString()) } -actual class A2 actual constructor(text: String) { actual constructor(number: Int) : this(number.toString()) } -actual class A3 protected constructor(text: String) { protected constructor(number: Int) : this(number.toString()) } -actual class A4 internal constructor(text: String) { internal constructor(number: Int) : this(number.toString()) } -actual class A5 private constructor(text: String) { private constructor(number: Int) : this(number.toString()) } +actual class A1 actual constructor(text: String) { + actual constructor(number: Int) : this(number.toString()) +} -actual class B1 protected actual constructor(text: String) { protected actual constructor(number: Int) : this(number.toString()) } -actual class B2 internal constructor(text: String) { internal constructor(number: Int) : this(number.toString()) } -actual class B3 private constructor(text: String) { private constructor(number: Int) : this(number.toString()) } +actual class A2 actual constructor(text: String) { + actual constructor(number: Int) : this(number.toString()) +} -actual class C1 internal actual constructor(text: String) { internal actual constructor(number: Int) : this(number.toString()) } -actual class C2 private constructor(text: String) { private constructor(number: Int) : this(number.toString()) } +actual class A3 protected constructor(text: String) { + protected constructor(number: Int) : this(number.toString()) +} -actual class D1 private constructor(text: String) { private constructor(number: Int) : this(number.toString()) } +actual class A4 internal constructor(text: String) { + internal constructor(number: Int) : this(number.toString()) +} + +actual class A5 private constructor(text: String) { + private constructor(number: Int) : this(number.toString()) +} + +actual class B1 protected actual constructor(text: String) { + protected actual constructor(number: Int) : this(number.toString()) +} + +actual class B2 internal constructor(text: String) { + internal constructor(number: Int) : this(number.toString()) +} + +actual class B3 private constructor(text: String) { + private constructor(number: Int) : this(number.toString()) +} + +actual class C1 internal actual constructor(text: String) { + internal actual constructor(number: Int) : this(number.toString()) +} + +actual class C2 private constructor(text: String) { + private constructor(number: Int) : this(number.toString()) +} + +actual class D1 private constructor(text: String) { + private constructor(number: Int) : this(number.toString()) +} actual class E { constructor(a: String) diff --git a/native/commonizer/testData/classifierCommonization/constructors/original/js/package_root.kt b/native/commonizer/testData/classifierCommonization/constructors/original/js/package_root.kt index f94a51858fc..12d74d176e2 100644 --- a/native/commonizer/testData/classifierCommonization/constructors/original/js/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/constructors/original/js/package_root.kt @@ -1,17 +1,46 @@ -class A1(text: String) { constructor(number: Int) : this(number.toString()) } -class A2(text: String) { constructor(number: Int) : this(number.toString()) } -class A3(text: String) { constructor(number: Int) : this(number.toString()) } -class A4(text: String) { constructor(number: Int) : this(number.toString()) } -class A5(text: String) { constructor(number: Int) : this(number.toString()) } +class A1(text: String) { + constructor(number: Int) : this(number.toString()) +} -class B1 protected constructor(text: String) { protected constructor(number: Int) : this(number.toString()) } -class B2 protected constructor(text: String) { protected constructor(number: Int) : this(number.toString()) } -class B3 protected constructor(text: String) { protected constructor(number: Int) : this(number.toString()) } +class A2(text: String) { + constructor(number: Int) : this(number.toString()) +} -class C1 internal constructor(text: String) { internal constructor(number: Int) : this(number.toString()) } -class C2 internal constructor(text: String) { internal constructor(number: Int) : this(number.toString()) } +class A3(text: String) { + constructor(number: Int) : this(number.toString()) +} -class D1 private constructor(text: String) { private constructor(number: Int) : this(number.toString()) } +class A4(text: String) { + constructor(number: Int) : this(number.toString()) +} + +class A5(text: String) { + constructor(number: Int) : this(number.toString()) +} + +class B1 protected constructor(text: String) { + protected constructor(number: Int) : this(number.toString()) +} + +class B2 protected constructor(text: String) { + protected constructor(number: Int) : this(number.toString()) +} + +class B3 protected constructor(text: String) { + protected constructor(number: Int) : this(number.toString()) +} + +class C1 internal constructor(text: String) { + internal constructor(number: Int) : this(number.toString()) +} + +class C2 internal constructor(text: String) { + internal constructor(number: Int) : this(number.toString()) +} + +class D1 private constructor(text: String) { + private constructor(number: Int) : this(number.toString()) +} class E { constructor(a: Int) diff --git a/native/commonizer/testData/classifierCommonization/constructors/original/jvm/package_root.kt b/native/commonizer/testData/classifierCommonization/constructors/original/jvm/package_root.kt index 9c01f7e57e7..da22b6c23a2 100644 --- a/native/commonizer/testData/classifierCommonization/constructors/original/jvm/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/constructors/original/jvm/package_root.kt @@ -1,17 +1,46 @@ -class A1(text: String) { constructor(number: Int) : this(number.toString()) } -class A2 constructor(text: String) { constructor(number: Int) : this(number.toString()) } -class A3 protected constructor(text: String) { protected constructor(number: Int) : this(number.toString()) } -class A4 internal constructor(text: String) { internal constructor(number: Int) : this(number.toString()) } -class A5 private constructor(text: String) { private constructor(number: Int) : this(number.toString()) } +class A1(text: String) { + constructor(number: Int) : this(number.toString()) +} -class B1 protected constructor(text: String) { protected constructor(number: Int) : this(number.toString()) } -class B2 internal constructor(text: String) { internal constructor(number: Int) : this(number.toString()) } -class B3 private constructor(text: String) { private constructor(number: Int) : this(number.toString()) } +class A2 constructor(text: String) { + constructor(number: Int) : this(number.toString()) +} -class C1 internal constructor(text: String) { internal constructor(number: Int) : this(number.toString()) } -class C2 private constructor(text: String) { private constructor(number: Int) : this(number.toString()) } +class A3 protected constructor(text: String) { + protected constructor(number: Int) : this(number.toString()) +} -class D1 private constructor(text: String) { private constructor(number: Int) : this(number.toString()) } +class A4 internal constructor(text: String) { + internal constructor(number: Int) : this(number.toString()) +} + +class A5 private constructor(text: String) { + private constructor(number: Int) : this(number.toString()) +} + +class B1 protected constructor(text: String) { + protected constructor(number: Int) : this(number.toString()) +} + +class B2 internal constructor(text: String) { + internal constructor(number: Int) : this(number.toString()) +} + +class B3 private constructor(text: String) { + private constructor(number: Int) : this(number.toString()) +} + +class C1 internal constructor(text: String) { + internal constructor(number: Int) : this(number.toString()) +} + +class C2 private constructor(text: String) { + private constructor(number: Int) : this(number.toString()) +} + +class D1 private constructor(text: String) { + private constructor(number: Int) : this(number.toString()) +} class E { constructor(a: String) diff --git a/native/commonizer/testData/classifierCommonization/differentTypeAliasesInArguments/commonized/common/package_root.kt b/native/commonizer/testData/classifierCommonization/differentTypeAliasesInArguments/commonized/common/package_root.kt index a386b944de9..d053fde1b8c 100644 --- a/native/commonizer/testData/classifierCommonization/differentTypeAliasesInArguments/commonized/common/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/differentTypeAliasesInArguments/commonized/common/package_root.kt @@ -1,3 +1,4 @@ typealias my_long_t = common.stuff.MyLong typealias MyTypeAlias = common.stuff.Wrapper + expect val property: MyTypeAlias diff --git a/native/commonizer/testData/classifierCommonization/differentTypeAliasesInArguments/commonized/linux/package_root.kt b/native/commonizer/testData/classifierCommonization/differentTypeAliasesInArguments/commonized/linux/package_root.kt index 9f537a20f78..184a52e6495 100644 --- a/native/commonizer/testData/classifierCommonization/differentTypeAliasesInArguments/commonized/linux/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/differentTypeAliasesInArguments/commonized/linux/package_root.kt @@ -1,2 +1,3 @@ typealias my_linux_long_t = common.stuff.MyLong + actual val property: MyTypeAlias = TODO() diff --git a/native/commonizer/testData/classifierCommonization/differentTypeAliasesInArguments/commonized/macos/package_root.kt b/native/commonizer/testData/classifierCommonization/differentTypeAliasesInArguments/commonized/macos/package_root.kt index cbd6b7778a3..962bc967f1e 100644 --- a/native/commonizer/testData/classifierCommonization/differentTypeAliasesInArguments/commonized/macos/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/differentTypeAliasesInArguments/commonized/macos/package_root.kt @@ -1,2 +1,3 @@ typealias my_macos_long_t = common.stuff.MyLong + actual val property: MyTypeAlias = TODO() diff --git a/native/commonizer/testData/classifierCommonization/differentTypeAliasesInArguments/original/linux/package_root.kt b/native/commonizer/testData/classifierCommonization/differentTypeAliasesInArguments/original/linux/package_root.kt index 2814fef234d..77dce871f00 100644 --- a/native/commonizer/testData/classifierCommonization/differentTypeAliasesInArguments/original/linux/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/differentTypeAliasesInArguments/original/linux/package_root.kt @@ -1,4 +1,5 @@ typealias my_long_t = my_linux_long_t typealias my_linux_long_t = common.stuff.MyLong typealias MyTypeAlias = common.stuff.Wrapper + val property: MyTypeAlias = TODO() diff --git a/native/commonizer/testData/classifierCommonization/differentTypeAliasesInArguments/original/macos/package_root.kt b/native/commonizer/testData/classifierCommonization/differentTypeAliasesInArguments/original/macos/package_root.kt index 014269e7431..ce9c1ea1453 100644 --- a/native/commonizer/testData/classifierCommonization/differentTypeAliasesInArguments/original/macos/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/differentTypeAliasesInArguments/original/macos/package_root.kt @@ -1,4 +1,5 @@ typealias my_long_t = my_macos_long_t typealias my_macos_long_t = common.stuff.MyLong typealias MyTypeAlias = common.stuff.Wrapper + val property: MyTypeAlias = TODO() diff --git a/native/commonizer/testData/classifierCommonization/supertypes/commonized/common/package_root.kt b/native/commonizer/testData/classifierCommonization/supertypes/commonized/common/package_root.kt index 6a51bed6e21..8628310459f 100644 --- a/native/commonizer/testData/classifierCommonization/supertypes/commonized/common/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/supertypes/commonized/common/package_root.kt @@ -3,12 +3,12 @@ expect interface A1 { fun function1(): Int } -expect abstract class A2(): A1 { +expect abstract class A2() : A1 { abstract val property2: Int abstract fun function2(): Int } -expect class A3 (): A2 { +expect class A3() : A2 { override val property1: Int override val property2: Int val property3: Int @@ -23,7 +23,7 @@ expect interface B1 { fun function1(): Int } -expect class B3(): B1 { +expect class B3() : B1 { override val property1: Int open val property2: Int val property3: Int @@ -38,7 +38,7 @@ expect interface C1 { fun function1(): Int } -expect class C3 (): C1 { +expect class C3() : C1 { override val property1: Int val property2: Int val property3: Int @@ -53,7 +53,7 @@ expect interface D2 { fun function2(): Int } -expect class D3(): D2 { +expect class D3() : D2 { open val property1: Int override val property2: Int val property3: Int diff --git a/native/commonizer/testData/classifierCommonization/supertypes/commonized/js/package_root.kt b/native/commonizer/testData/classifierCommonization/supertypes/commonized/js/package_root.kt index 8506b925c57..d75c347252f 100644 --- a/native/commonizer/testData/classifierCommonization/supertypes/commonized/js/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/supertypes/commonized/js/package_root.kt @@ -3,12 +3,12 @@ actual interface A1 { actual fun function1(): Int } -actual abstract class A2 actual constructor(): A1 { +actual abstract class A2 actual constructor() : A1 { actual abstract val property2: Int actual abstract fun function2(): Int } -actual class A3 actual constructor(): A2() { +actual class A3 actual constructor() : A2() { actual override val property1 = 1 actual override val property2 = 1 actual val property3 = 1 @@ -28,7 +28,7 @@ interface B2 { fun function2(): Int } -actual class B3 actual constructor(): B1, B2 { +actual class B3 actual constructor() : B1, B2 { actual override val property1 = 1 actual override val property2 = 1 actual val property3 = 1 @@ -48,7 +48,7 @@ interface C2 { fun function2(): Int } -actual class C3 actual constructor(): C1, C2 { +actual class C3 actual constructor() : C1, C2 { actual override val property1 = 1 actual override val property2 = 1 actual val property3 = 1 @@ -68,7 +68,7 @@ actual interface D2 { actual fun function2(): Int } -actual class D3 actual constructor(): D1, D2 { +actual class D3 actual constructor() : D1, D2 { actual override val property1 = 1 actual override val property2 = 1 actual val property3 = 1 diff --git a/native/commonizer/testData/classifierCommonization/supertypes/commonized/jvm/package_root.kt b/native/commonizer/testData/classifierCommonization/supertypes/commonized/jvm/package_root.kt index a2a3e17d64c..a2640bbc03d 100644 --- a/native/commonizer/testData/classifierCommonization/supertypes/commonized/jvm/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/supertypes/commonized/jvm/package_root.kt @@ -3,12 +3,12 @@ actual interface A1 { actual fun function1(): Int } -actual abstract class A2 actual constructor(): A1 { +actual abstract class A2 actual constructor() : A1 { actual abstract val property2: Int actual abstract fun function2(): Int } -actual class A3 actual constructor(): A2(), A1 { +actual class A3 actual constructor() : A2(), A1 { actual override val property1 = 1 actual override val property2 = 1 actual val property3 = 1 @@ -26,7 +26,7 @@ actual interface B1 { fun function2(): Int } -actual class B3 actual constructor(): B1 { +actual class B3 actual constructor() : B1 { actual override val property1 = 1 actual override val property2 = 1 actual val property3 = 1 @@ -41,7 +41,7 @@ actual interface C1 { actual fun function1(): Int } -actual class C3 actual constructor(): C1 { +actual class C3 actual constructor() : C1 { actual override val property1 = 1 actual val property2 = 1 actual val property3 = 1 @@ -61,7 +61,7 @@ actual interface D2 { actual fun function2(): Int } -actual class D3 actual constructor(): D1(), D2 { +actual class D3 actual constructor() : D1(), D2 { actual override val property1 = 1 actual override val property2 = 1 actual val property3 = 1 diff --git a/native/commonizer/testData/classifierCommonization/typeAliases/commonized/common/package_root.kt b/native/commonizer/testData/classifierCommonization/typeAliases/commonized/common/package_root.kt index fcfa4e7bb29..8ebbde00256 100644 --- a/native/commonizer/testData/classifierCommonization/typeAliases/commonized/common/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/typeAliases/commonized/common/package_root.kt @@ -32,10 +32,12 @@ typealias R = Function // something complex // Type aliases converted to expect classes: typealias S = String + expect class T // Nullability: typealias U = A // same nullability of the RHS class + expect class V // different nullability of the RHS class typealias W = A // same nullability of the RHS TA typealias Y = V // TA at the RHS with the different nullability of own RHS diff --git a/native/commonizer/testData/classifierCommonization/typeAliases/commonized/linux/package_root.kt b/native/commonizer/testData/classifierCommonization/typeAliases/commonized/linux/package_root.kt index 6e61a83b4a4..38af937ef0a 100644 --- a/native/commonizer/testData/classifierCommonization/typeAliases/commonized/linux/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/typeAliases/commonized/linux/package_root.kt @@ -19,6 +19,7 @@ typealias X = U? // different nullability of the RHS TA // Supertypes: actual typealias FILE = _IO_FILE + final class _IO_FILE : kotlinx.cinterop.CStructVar {} actual val uuid: uuid_t get() = TODO() diff --git a/native/commonizer/testData/classifierCommonization/typeAliases/commonized/macos/package_root.kt b/native/commonizer/testData/classifierCommonization/typeAliases/commonized/macos/package_root.kt index 44df04fb334..7d66ad738e2 100644 --- a/native/commonizer/testData/classifierCommonization/typeAliases/commonized/macos/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/typeAliases/commonized/macos/package_root.kt @@ -19,6 +19,7 @@ typealias X = U // different nullability of the RHS TA // Supertypes: actual typealias FILE = __sFILE + final class __sFILE : kotlinx.cinterop.CStructVar {} actual val uuid: uuid_t get() = TODO() diff --git a/native/commonizer/testData/classifierCommonization/typeAliases/dependency/common/package_kotlinx_cinterop.kt b/native/commonizer/testData/classifierCommonization/typeAliases/dependency/common/package_kotlinx_cinterop.kt index cf366643a8f..e417aa4e34d 100644 --- a/native/commonizer/testData/classifierCommonization/typeAliases/dependency/common/package_kotlinx_cinterop.kt +++ b/native/commonizer/testData/classifierCommonization/typeAliases/dependency/common/package_kotlinx_cinterop.kt @@ -4,7 +4,9 @@ package kotlinx.cinterop // fake classes with the default constructor and no member scope abstract class CStructVar class CPointer -@Suppress("FINAL_UPPER_BOUND") class UByteVarOf + +@Suppress("FINAL_UPPER_BOUND") +class UByteVarOf class UByte // fake typealiases diff --git a/native/commonizer/testData/classifierCommonization/typeAliases/original/linux/package_root.kt b/native/commonizer/testData/classifierCommonization/typeAliases/original/linux/package_root.kt index da6e54591eb..8ae4f25ec6c 100644 --- a/native/commonizer/testData/classifierCommonization/typeAliases/original/linux/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/typeAliases/original/linux/package_root.kt @@ -50,6 +50,7 @@ typealias Y = V // TA at the RHS with the different nullability of own RHS // Supertypes: typealias FILE = _IO_FILE + final class _IO_FILE : kotlinx.cinterop.CStructVar {} typealias uuid_t = __darwin_uuid_t diff --git a/native/commonizer/testData/classifierCommonization/typeAliases/original/macos/package_root.kt b/native/commonizer/testData/classifierCommonization/typeAliases/original/macos/package_root.kt index eccc25445c8..ccb397b79a3 100644 --- a/native/commonizer/testData/classifierCommonization/typeAliases/original/macos/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/typeAliases/original/macos/package_root.kt @@ -50,6 +50,7 @@ typealias Y = V // TA at the RHS with the different nullability of own RHS // Supertypes: typealias FILE = __sFILE + final class __sFILE : kotlinx.cinterop.CStructVar {} typealias uuid_t = __darwin_uuid_t diff --git a/native/commonizer/testData/classifierCommonization/typeParameters/commonized/common/package_root.kt b/native/commonizer/testData/classifierCommonization/typeParameters/commonized/common/package_root.kt index 746e8c5010a..a21c5398f7e 100644 --- a/native/commonizer/testData/classifierCommonization/typeParameters/commonized/common/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/typeParameters/commonized/common/package_root.kt @@ -12,6 +12,7 @@ expect class A2() { fun function(value: T): T } } + expect class B4() { val property: T fun function(value: T): T @@ -26,6 +27,7 @@ expect class B4() { fun function(value: T): T } } + expect class C5() { val property: T fun function(value: T): T @@ -40,6 +42,7 @@ expect class C5() { fun function(value: T): T } } + expect class D6() { val property: T fun function(value: T): T @@ -54,6 +57,7 @@ expect class D6() { fun function(value: T): T } } + expect class E7() { val property: String fun function(value: String): String @@ -68,6 +72,7 @@ expect class E7() { fun function(value: String): String } } + expect class F1() { val property: T fun function(value: T): T @@ -82,6 +87,7 @@ expect class F1() { fun function(value: T): T } } + expect class G1() { val property1: T val property2: R @@ -112,6 +118,7 @@ expect class H1() { val T.independentExtensionProperty: T fun T.independentExtensionFunction(): T } + expect class H2() { val dependentProperty: T fun dependentFunction(value: T): T @@ -128,10 +135,12 @@ expect class I>() { expect interface J1 { fun a(): A } + expect interface J2 { fun a(b: B): A fun b(a: A): B } + expect interface J3 { fun a(b: B, c: C): A fun b(a: A, c: C): B diff --git a/native/commonizer/testData/classifierCommonization/typeParameters/commonized/js/package_root.kt b/native/commonizer/testData/classifierCommonization/typeParameters/commonized/js/package_root.kt index cd34b0bfd89..e82e6c745eb 100644 --- a/native/commonizer/testData/classifierCommonization/typeParameters/commonized/js/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/typeParameters/commonized/js/package_root.kt @@ -12,6 +12,7 @@ class A1 { fun function(value: T): T = value } } + actual class A2 actual constructor() { actual val property: T get() = TODO() actual fun function(value: T): T = value @@ -26,6 +27,7 @@ actual class A2 actual constructor() { actual fun function(value: T): T = value } } + class A3 { val property: T get() = TODO() fun function(value: T): T = value @@ -40,6 +42,7 @@ class A3 { fun function(value: T): T = value } } + class A4 { val property: T get() = TODO() fun function(value: T): T = value @@ -54,6 +57,7 @@ class A4 { fun function(value: T): T = value } } + class A5 { val property: T get() = TODO() fun function(value: T): T = value @@ -68,6 +72,7 @@ class A5 { fun function(value: T): T = value } } + class A6 { val property: T get() = TODO() fun function(value: T): T = value @@ -82,6 +87,7 @@ class A6 { fun function(value: T): T = value } } + class A7 { val property: T get() = TODO() fun function(value: T): T = value @@ -111,6 +117,7 @@ class B1 { fun function(value: T): T = value } } + class B2 { val property: T get() = TODO() fun function(value: T): T = value @@ -125,6 +132,7 @@ class B2 { fun function(value: T): T = value } } + class B3 { val property: T get() = TODO() fun function(value: T): T = value @@ -139,6 +147,7 @@ class B3 { fun function(value: T): T = value } } + actual class B4 actual constructor() { actual val property: T get() = TODO() actual fun function(value: T): T = value @@ -153,6 +162,7 @@ actual class B4 actual constructor() { actual fun function(value: T): T = value } } + class B5 { val property: T get() = TODO() fun function(value: T): T = value @@ -167,6 +177,7 @@ class B5 { fun function(value: T): T = value } } + class B6 { val property: T get() = TODO() fun function(value: T): T = value @@ -181,6 +192,7 @@ class B6 { fun function(value: T): T = value } } + class B7 { val property: T get() = TODO() fun function(value: T): T = value @@ -210,6 +222,7 @@ class C1 { fun function(value: T): T = value } } + class C2 { val property: T get() = TODO() fun function(value: T): T = value @@ -224,6 +237,7 @@ class C2 { fun function(value: T): T = value } } + class C3 { val property: T get() = TODO() fun function(value: T): T = value @@ -238,6 +252,7 @@ class C3 { fun function(value: T): T = value } } + class C4 { val property: T get() = TODO() fun function(value: T): T = value @@ -252,6 +267,7 @@ class C4 { fun function(value: T): T = value } } + actual class C5 actual constructor() { actual val property: T get() = TODO() actual fun function(value: T): T = value @@ -266,6 +282,7 @@ actual class C5 actual constructor() { actual fun function(value: T): T = value } } + class C6 { val property: T get() = TODO() fun function(value: T): T = value @@ -280,6 +297,7 @@ class C6 { fun function(value: T): T = value } } + class C7 { val property: T get() = TODO() fun function(value: T): T = value @@ -309,6 +327,7 @@ class D1 { fun function(value: T): T = value } } + class D2 { val property: T get() = TODO() fun function(value: T): T = value @@ -323,6 +342,7 @@ class D2 { fun function(value: T): T = value } } + class D3 { val property: T get() = TODO() fun function(value: T): T = value @@ -337,6 +357,7 @@ class D3 { fun function(value: T): T = value } } + class D4 { val property: T get() = TODO() fun function(value: T): T = value @@ -351,6 +372,7 @@ class D4 { fun function(value: T): T = value } } + class D5 { val property: T get() = TODO() fun function(value: T): T = value @@ -365,6 +387,7 @@ class D5 { fun function(value: T): T = value } } + actual class D6 actual constructor() { actual val property: T get() = TODO() actual fun function(value: T): T = value @@ -379,6 +402,7 @@ actual class D6 actual constructor() { actual fun function(value: T): T = value } } + class D7 { val property: T get() = TODO() fun function(value: T): T = value @@ -408,6 +432,7 @@ class E1 { fun function(value: String): String = value } } + class E2 { val property: String get() = TODO() fun function(value: String): String = value @@ -422,6 +447,7 @@ class E2 { fun function(value: String): String = value } } + class E3 { val property: String get() = TODO() fun function(value: String): String = value @@ -436,6 +462,7 @@ class E3 { fun function(value: String): String = value } } + class E4 { val property: String get() = TODO() fun function(value: String): String = value @@ -450,6 +477,7 @@ class E4 { fun function(value: String): String = value } } + class E5 { val property: String get() = TODO() fun function(value: String): String = value @@ -464,6 +492,7 @@ class E5 { fun function(value: String): String = value } } + class E6 { val property: String get() = TODO() fun function(value: String): String = value @@ -478,6 +507,7 @@ class E6 { fun function(value: String): String = value } } + actual class E7 actual constructor() { actual val property: String get() = TODO() actual fun function(value: String): String = value @@ -507,6 +537,7 @@ actual class F1 actual constructor() { actual fun function(value: T): T = value } } + class F2 { val property: T get() = TODO() fun function(value: T): T = value @@ -521,6 +552,7 @@ class F2 { fun function(value: T): T = value } } + class F3 { val property: T get() = TODO() fun function(value: T): T = value @@ -553,6 +585,7 @@ actual class G1 actual constructor() { actual fun function(value: T): R = TODO() } } + class G2 { val property1: T get() = TODO() val property2: R get() = TODO() @@ -570,6 +603,7 @@ class G2 { fun function(value: T): R = TODO() } } + class G3 { val property1: T get() = TODO() val property2: R get() = TODO() @@ -587,6 +621,7 @@ class G3 { fun function(value: T): R = TODO() } } + class G4 { val property1: T get() = TODO() val property2: R get() = TODO() @@ -617,6 +652,7 @@ actual class H1 actual constructor() { actual val T.independentExtensionProperty: T get() = this actual fun T.independentExtensionFunction(): T = this } + actual class H2 actual constructor() { actual val dependentProperty: T get() = TODO() actual fun dependentFunction(value: T): T = value @@ -638,10 +674,12 @@ actual class I> actual constructor() { actual interface J1 { actual fun a(): A } + actual interface J2 { actual fun a(b: B): A actual fun b(a: A): B } + actual interface J3 { actual fun a(b: B, c: C): A actual fun b(a: A, c: C): B diff --git a/native/commonizer/testData/classifierCommonization/typeParameters/commonized/jvm/package_root.kt b/native/commonizer/testData/classifierCommonization/typeParameters/commonized/jvm/package_root.kt index 93f22eb83fe..f35c145b5e0 100644 --- a/native/commonizer/testData/classifierCommonization/typeParameters/commonized/jvm/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/typeParameters/commonized/jvm/package_root.kt @@ -12,6 +12,7 @@ class A1 { fun function(value: Any): Any = value } } + actual class A2 actual constructor() { actual val property: T get() = TODO() actual fun function(value: T): T = value @@ -26,6 +27,7 @@ actual class A2 actual constructor() { actual fun function(value: T): T = value } } + class A3 { val property: R get() = TODO() fun function(value: R): R = value @@ -40,6 +42,7 @@ class A3 { fun function(value: R): R = value } } + class A4 { val property: T get() = TODO() fun function(value: T): T = value @@ -54,6 +57,7 @@ class A4 { fun function(value: T): T = value } } + class A5 { val property: T get() = TODO() fun function(value: T): T = value @@ -68,6 +72,7 @@ class A5 { fun function(value: T): T = value } } + class A6 { val property: T get() = TODO() fun function(value: T): T = value @@ -82,6 +87,7 @@ class A6 { fun function(value: T): T = value } } + class A7 { val property: String get() = TODO() fun function(value: String): String = value @@ -111,6 +117,7 @@ class B1 { fun function(value: Any): Any = value } } + class B2 { val property: T get() = TODO() fun function(value: T): T = value @@ -125,6 +132,7 @@ class B2 { fun function(value: T): T = value } } + class B3 { val property: R get() = TODO() fun function(value: R): R = value @@ -139,6 +147,7 @@ class B3 { fun function(value: R): R = value } } + actual class B4 actual constructor() { actual val property: T get() = TODO() actual fun function(value: T): T = value @@ -153,6 +162,7 @@ actual class B4 actual constructor() { actual fun function(value: T): T = value } } + class B5 { val property: T get() = TODO() fun function(value: T): T = value @@ -167,6 +177,7 @@ class B5 { fun function(value: T): T = value } } + class B6 { val property: T get() = TODO() fun function(value: T): T = value @@ -181,6 +192,7 @@ class B6 { fun function(value: T): T = value } } + class B7 { val property: String get() = TODO() fun function(value: String): String = value @@ -210,11 +222,12 @@ class C1 { fun function(value: Any): Any = value } } + class C2 { val property: T get() = TODO() fun function(value: T): T = value - class Nested{ + class Nested { val property: T get() = TODO() fun function(value: T): T = value } @@ -224,6 +237,7 @@ class C2 { fun function(value: T): T = value } } + class C3 { val property: R get() = TODO() fun function(value: R): R = value @@ -238,6 +252,7 @@ class C3 { fun function(value: R): R = value } } + class C4 { val property: T get() = TODO() fun function(value: T): T = value @@ -252,6 +267,7 @@ class C4 { fun function(value: T): T = value } } + actual class C5 actual constructor() { actual val property: T get() = TODO() actual fun function(value: T): T = value @@ -266,6 +282,7 @@ actual class C5 actual constructor() { actual fun function(value: T): T = value } } + class C6 { val property: T get() = TODO() fun function(value: T): T = value @@ -280,6 +297,7 @@ class C6 { fun function(value: T): T = value } } + class C7 { val property: String get() = TODO() fun function(value: String): String = value @@ -309,6 +327,7 @@ class D1 { fun function(value: Any): Any = value } } + class D2 { val property: T get() = TODO() fun function(value: T): T = value @@ -323,6 +342,7 @@ class D2 { fun function(value: T): T = value } } + class D3 { val property: R get() = TODO() fun function(value: R): R = value @@ -337,6 +357,7 @@ class D3 { fun function(value: R): R = value } } + class D4 { val property: T get() = TODO() fun function(value: T): T = value @@ -351,6 +372,7 @@ class D4 { fun function(value: T): T = value } } + class D5 { val property: T get() = TODO() fun function(value: T): T = value @@ -365,6 +387,7 @@ class D5 { fun function(value: T): T = value } } + actual class D6 actual constructor() { actual val property: T get() = TODO() actual fun function(value: T): T = value @@ -379,6 +402,7 @@ actual class D6 actual constructor() { actual fun function(value: T): T = value } } + class D7 { val property: String get() = TODO() fun function(value: String): String = value @@ -408,6 +432,7 @@ class E1 { fun function(value: Any): Any = value } } + class E2 { val property: T get() = TODO() fun function(value: T): T = value @@ -422,6 +447,7 @@ class E2 { fun function(value: T): T = value } } + class E3 { val property: R get() = TODO() fun function(value: R): R = value @@ -436,6 +462,7 @@ class E3 { fun function(value: R): R = value } } + class E4 { val property: T get() = TODO() fun function(value: T): T = value @@ -450,6 +477,7 @@ class E4 { fun function(value: T): T = value } } + class E5 { val property: T get() = TODO() fun function(value: T): T = value @@ -464,6 +492,7 @@ class E5 { fun function(value: T): T = value } } + class E6 { val property: T get() = TODO() fun function(value: T): T = value @@ -478,6 +507,7 @@ class E6 { fun function(value: T): T = value } } + actual class E7 actual constructor() { actual val property: String get() = TODO() actual fun function(value: String): String = value @@ -507,6 +537,7 @@ actual class F1 actual constructor() { actual fun function(value: T): T = value } } + class F2 { val property: String get() = TODO() fun function(value: T): Any = TODO() @@ -521,6 +552,7 @@ class F2 { fun function(value: T): Any = TODO() } } + class F3 { val property: T get() = TODO() fun function(value: Any): T = TODO() @@ -553,6 +585,7 @@ actual class G1 actual constructor() { actual fun function(value: T): R = TODO() } } + class G2 { val property1: T get() = TODO() val property2: T get() = TODO() @@ -570,6 +603,7 @@ class G2 { fun function(value: T): T = value } } + class G3 { val property1: R get() = TODO() val property2: R get() = TODO() @@ -587,6 +621,7 @@ class G3 { fun function(value: R): R = value } } + class G4 { val property1: T get() = TODO() val property2: R get() = TODO() @@ -617,6 +652,7 @@ actual class H1 actual constructor() { actual val T.independentExtensionProperty: T get() = this actual fun T.independentExtensionFunction(): T = this } + actual class H2 actual constructor() { actual val dependentProperty: T get() = TODO() actual fun dependentFunction(value: T): T = value @@ -638,10 +674,12 @@ actual class I> actual constructor() { actual interface J1 { actual fun a(): A } + actual interface J2 { actual fun a(b: B): A actual fun b(a: A): B } + actual interface J3 { actual fun a(b: B, c: C): A actual fun b(a: A, c: C): B diff --git a/native/commonizer/testData/classifierCommonization/typeParameters/original/js/package_root.kt b/native/commonizer/testData/classifierCommonization/typeParameters/original/js/package_root.kt index fc3825be60c..d8247196888 100644 --- a/native/commonizer/testData/classifierCommonization/typeParameters/original/js/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/typeParameters/original/js/package_root.kt @@ -12,6 +12,7 @@ class A1 { fun function(value: T): T = value } } + class A2 { val property: T get() = TODO() fun function(value: T): T = value @@ -26,6 +27,7 @@ class A2 { fun function(value: T): T = value } } + class A3 { val property: T get() = TODO() fun function(value: T): T = value @@ -40,6 +42,7 @@ class A3 { fun function(value: T): T = value } } + class A4 { val property: T get() = TODO() fun function(value: T): T = value @@ -54,6 +57,7 @@ class A4 { fun function(value: T): T = value } } + class A5 { val property: T get() = TODO() fun function(value: T): T = value @@ -68,6 +72,7 @@ class A5 { fun function(value: T): T = value } } + class A6 { val property: T get() = TODO() fun function(value: T): T = value @@ -82,6 +87,7 @@ class A6 { fun function(value: T): T = value } } + class A7 { val property: T get() = TODO() fun function(value: T): T = value @@ -111,6 +117,7 @@ class B1 { fun function(value: T): T = value } } + class B2 { val property: T get() = TODO() fun function(value: T): T = value @@ -125,6 +132,7 @@ class B2 { fun function(value: T): T = value } } + class B3 { val property: T get() = TODO() fun function(value: T): T = value @@ -139,6 +147,7 @@ class B3 { fun function(value: T): T = value } } + class B4 { val property: T get() = TODO() fun function(value: T): T = value @@ -153,6 +162,7 @@ class B4 { fun function(value: T): T = value } } + class B5 { val property: T get() = TODO() fun function(value: T): T = value @@ -167,6 +177,7 @@ class B5 { fun function(value: T): T = value } } + class B6 { val property: T get() = TODO() fun function(value: T): T = value @@ -181,6 +192,7 @@ class B6 { fun function(value: T): T = value } } + class B7 { val property: T get() = TODO() fun function(value: T): T = value @@ -210,6 +222,7 @@ class C1 { fun function(value: T): T = value } } + class C2 { val property: T get() = TODO() fun function(value: T): T = value @@ -224,6 +237,7 @@ class C2 { fun function(value: T): T = value } } + class C3 { val property: T get() = TODO() fun function(value: T): T = value @@ -238,6 +252,7 @@ class C3 { fun function(value: T): T = value } } + class C4 { val property: T get() = TODO() fun function(value: T): T = value @@ -252,6 +267,7 @@ class C4 { fun function(value: T): T = value } } + class C5 { val property: T get() = TODO() fun function(value: T): T = value @@ -266,6 +282,7 @@ class C5 { fun function(value: T): T = value } } + class C6 { val property: T get() = TODO() fun function(value: T): T = value @@ -280,6 +297,7 @@ class C6 { fun function(value: T): T = value } } + class C7 { val property: T get() = TODO() fun function(value: T): T = value @@ -309,6 +327,7 @@ class D1 { fun function(value: T): T = value } } + class D2 { val property: T get() = TODO() fun function(value: T): T = value @@ -323,6 +342,7 @@ class D2 { fun function(value: T): T = value } } + class D3 { val property: T get() = TODO() fun function(value: T): T = value @@ -337,6 +357,7 @@ class D3 { fun function(value: T): T = value } } + class D4 { val property: T get() = TODO() fun function(value: T): T = value @@ -351,6 +372,7 @@ class D4 { fun function(value: T): T = value } } + class D5 { val property: T get() = TODO() fun function(value: T): T = value @@ -365,6 +387,7 @@ class D5 { fun function(value: T): T = value } } + class D6 { val property: T get() = TODO() fun function(value: T): T = value @@ -379,6 +402,7 @@ class D6 { fun function(value: T): T = value } } + class D7 { val property: T get() = TODO() fun function(value: T): T = value @@ -408,6 +432,7 @@ class E1 { fun function(value: String): String = value } } + class E2 { val property: String get() = TODO() fun function(value: String): String = value @@ -422,6 +447,7 @@ class E2 { fun function(value: String): String = value } } + class E3 { val property: String get() = TODO() fun function(value: String): String = value @@ -436,6 +462,7 @@ class E3 { fun function(value: String): String = value } } + class E4 { val property: String get() = TODO() fun function(value: String): String = value @@ -450,6 +477,7 @@ class E4 { fun function(value: String): String = value } } + class E5 { val property: String get() = TODO() fun function(value: String): String = value @@ -464,6 +492,7 @@ class E5 { fun function(value: String): String = value } } + class E6 { val property: String get() = TODO() fun function(value: String): String = value @@ -478,6 +507,7 @@ class E6 { fun function(value: String): String = value } } + class E7 { val property: String get() = TODO() fun function(value: String): String = value @@ -507,6 +537,7 @@ class F1 { fun function(value: T): T = value } } + class F2 { val property: T get() = TODO() fun function(value: T): T = value @@ -521,6 +552,7 @@ class F2 { fun function(value: T): T = value } } + class F3 { val property: T get() = TODO() fun function(value: T): T = value @@ -553,6 +585,7 @@ class G1 { fun function(value: T): R = TODO() } } + class G2 { val property1: T get() = TODO() val property2: R get() = TODO() @@ -570,6 +603,7 @@ class G2 { fun function(value: T): R = TODO() } } + class G3 { val property1: T get() = TODO() val property2: R get() = TODO() @@ -587,6 +621,7 @@ class G3 { fun function(value: T): R = TODO() } } + class G4 { val property1: T get() = TODO() val property2: R get() = TODO() @@ -617,6 +652,7 @@ class H1 { val T.independentExtensionProperty: T get() = this fun T.independentExtensionFunction(): T = this } + class H2 { val dependentProperty: T get() = TODO() fun dependentFunction(value: T): T = value @@ -638,10 +674,12 @@ class I> { interface J1 { actual fun a(): A } + interface J2 { actual fun a(b: B): A actual fun b(a: A): B } + interface J3 { actual fun a(b: B, c: C): A actual fun b(a: A, c: C): B diff --git a/native/commonizer/testData/classifierCommonization/typeParameters/original/jvm/package_root.kt b/native/commonizer/testData/classifierCommonization/typeParameters/original/jvm/package_root.kt index 1b510bb34c4..308e5e6cf6e 100644 --- a/native/commonizer/testData/classifierCommonization/typeParameters/original/jvm/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/typeParameters/original/jvm/package_root.kt @@ -12,6 +12,7 @@ class A1 { fun function(value: Any): Any = value } } + class A2 { val property: T get() = TODO() fun function(value: T): T = value @@ -26,6 +27,7 @@ class A2 { fun function(value: T): T = value } } + class A3 { val property: R get() = TODO() fun function(value: R): R = value @@ -40,6 +42,7 @@ class A3 { fun function(value: R): R = value } } + class A4 { val property: T get() = TODO() fun function(value: T): T = value @@ -54,6 +57,7 @@ class A4 { fun function(value: T): T = value } } + class A5 { val property: T get() = TODO() fun function(value: T): T = value @@ -68,6 +72,7 @@ class A5 { fun function(value: T): T = value } } + class A6 { val property: T get() = TODO() fun function(value: T): T = value @@ -82,6 +87,7 @@ class A6 { fun function(value: T): T = value } } + class A7 { val property: String get() = TODO() fun function(value: String): String = value @@ -111,6 +117,7 @@ class B1 { fun function(value: Any): Any = value } } + class B2 { val property: T get() = TODO() fun function(value: T): T = value @@ -125,6 +132,7 @@ class B2 { fun function(value: T): T = value } } + class B3 { val property: R get() = TODO() fun function(value: R): R = value @@ -139,6 +147,7 @@ class B3 { fun function(value: R): R = value } } + class B4 { val property: T get() = TODO() fun function(value: T): T = value @@ -153,6 +162,7 @@ class B4 { fun function(value: T): T = value } } + class B5 { val property: T get() = TODO() fun function(value: T): T = value @@ -167,6 +177,7 @@ class B5 { fun function(value: T): T = value } } + class B6 { val property: T get() = TODO() fun function(value: T): T = value @@ -181,6 +192,7 @@ class B6 { fun function(value: T): T = value } } + class B7 { val property: String get() = TODO() fun function(value: String): String = value @@ -210,11 +222,12 @@ class C1 { fun function(value: Any): Any = value } } + class C2 { val property: T get() = TODO() fun function(value: T): T = value - class Nested{ + class Nested { val property: T get() = TODO() fun function(value: T): T = value } @@ -224,6 +237,7 @@ class C2 { fun function(value: T): T = value } } + class C3 { val property: R get() = TODO() fun function(value: R): R = value @@ -238,6 +252,7 @@ class C3 { fun function(value: R): R = value } } + class C4 { val property: T get() = TODO() fun function(value: T): T = value @@ -252,6 +267,7 @@ class C4 { fun function(value: T): T = value } } + class C5 { val property: T get() = TODO() fun function(value: T): T = value @@ -266,6 +282,7 @@ class C5 { fun function(value: T): T = value } } + class C6 { val property: T get() = TODO() fun function(value: T): T = value @@ -280,6 +297,7 @@ class C6 { fun function(value: T): T = value } } + class C7 { val property: String get() = TODO() fun function(value: String): String = value @@ -309,6 +327,7 @@ class D1 { fun function(value: Any): Any = value } } + class D2 { val property: T get() = TODO() fun function(value: T): T = value @@ -323,6 +342,7 @@ class D2 { fun function(value: T): T = value } } + class D3 { val property: R get() = TODO() fun function(value: R): R = value @@ -337,6 +357,7 @@ class D3 { fun function(value: R): R = value } } + class D4 { val property: T get() = TODO() fun function(value: T): T = value @@ -351,6 +372,7 @@ class D4 { fun function(value: T): T = value } } + class D5 { val property: T get() = TODO() fun function(value: T): T = value @@ -365,6 +387,7 @@ class D5 { fun function(value: T): T = value } } + class D6 { val property: T get() = TODO() fun function(value: T): T = value @@ -379,6 +402,7 @@ class D6 { fun function(value: T): T = value } } + class D7 { val property: String get() = TODO() fun function(value: String): String = value @@ -408,6 +432,7 @@ class E1 { fun function(value: Any): Any = value } } + class E2 { val property: T get() = TODO() fun function(value: T): T = value @@ -422,6 +447,7 @@ class E2 { fun function(value: T): T = value } } + class E3 { val property: R get() = TODO() fun function(value: R): R = value @@ -436,6 +462,7 @@ class E3 { fun function(value: R): R = value } } + class E4 { val property: T get() = TODO() fun function(value: T): T = value @@ -450,6 +477,7 @@ class E4 { fun function(value: T): T = value } } + class E5 { val property: T get() = TODO() fun function(value: T): T = value @@ -464,6 +492,7 @@ class E5 { fun function(value: T): T = value } } + class E6 { val property: T get() = TODO() fun function(value: T): T = value @@ -478,6 +507,7 @@ class E6 { fun function(value: T): T = value } } + class E7 { val property: String get() = TODO() fun function(value: String): String = value @@ -507,6 +537,7 @@ class F1 { fun function(value: T): T = value } } + class F2 { val property: String get() = TODO() fun function(value: T): Any = TODO() @@ -521,6 +552,7 @@ class F2 { fun function(value: T): Any = TODO() } } + class F3 { val property: T get() = TODO() fun function(value: Any): T = TODO() @@ -553,6 +585,7 @@ class G1 { fun function(value: T): R = TODO() } } + class G2 { val property1: T get() = TODO() val property2: T get() = TODO() @@ -570,6 +603,7 @@ class G2 { fun function(value: T): T = value } } + class G3 { val property1: R get() = TODO() val property2: R get() = TODO() @@ -587,6 +621,7 @@ class G3 { fun function(value: R): R = value } } + class G4 { val property1: T get() = TODO() val property2: R get() = TODO() @@ -617,6 +652,7 @@ class H1 { val T.independentExtensionProperty: T get() = this fun T.independentExtensionFunction(): T = this } + class H2 { val dependentProperty: T get() = TODO() fun dependentFunction(value: T): T = value @@ -638,10 +674,12 @@ class I> { interface J1 { actual fun a(): A } + interface J2 { actual fun a(b: B): A actual fun b(a: A): B } + interface J3 { actual fun a(b: B, c: C): A actual fun b(a: A, c: C): B diff --git a/native/commonizer/testData/classifierCommonization/visibility/commonized/common/package_root.kt b/native/commonizer/testData/classifierCommonization/visibility/commonized/common/package_root.kt index 4181231ec79..5955310932d 100644 --- a/native/commonizer/testData/classifierCommonization/visibility/commonized/common/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/visibility/commonized/common/package_root.kt @@ -5,13 +5,16 @@ internal expect class C1() public typealias E1 = A1 protected typealias E2 = A1 internal typealias E3 = A1 + public expect class E4 protected typealias F1 = A1 + public expect class F2 public expect class F3 internal typealias G1 = A1 + public expect class G2 public expect class H1 diff --git a/native/commonizer/testData/functionCommonization/annotations/commonized/common/package_root.kt b/native/commonizer/testData/functionCommonization/annotations/commonized/common/package_root.kt index ce54f4ef979..bfafefd0d04 100644 --- a/native/commonizer/testData/functionCommonization/annotations/commonized/common/package_root.kt +++ b/native/commonizer/testData/functionCommonization/annotations/commonized/common/package_root.kt @@ -4,42 +4,63 @@ expect class Holder() { @Deprecated("See concrete deprecation messages in actual declarations") expect fun deprecatedFunctionWithCustomizedAnnotation1() + @Deprecated("This function is deprecated") expect fun deprecatedFunctionWithCustomizedAnnotation2() + @Deprecated("This function is deprecated") expect fun deprecatedFunctionWithCustomizedAnnotation3() + @Deprecated("This function is deprecated", level = DeprecationLevel.ERROR) expect fun deprecatedFunctionWithCustomizedAnnotation4() + @Deprecated("This function is deprecated") expect fun deprecatedFunctionWithCustomizedAnnotation5() + @Deprecated("This function is deprecated") expect fun deprecatedFunctionWithCustomizedAnnotation6() + @Deprecated("This function is deprecated") expect fun deprecatedFunctionWithCustomizedAnnotation7() + @Deprecated("This function is deprecated") expect fun deprecatedFunctionWithCustomizedAnnotation8() + @Deprecated("This function is deprecated") expect fun deprecatedFunctionWithCustomizedAnnotation9() + @Deprecated("This function is deprecated") expect fun deprecatedFunctionWithCustomizedAnnotation10() + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("foo()")) expect fun deprecatedFunctionWithCustomizedAnnotation11() + @Deprecated("This function is deprecated") expect fun deprecatedFunctionWithCustomizedAnnotation12() + @Deprecated("This function is deprecated") expect fun deprecatedFunctionWithCustomizedAnnotation13() + @Deprecated("This function is deprecated") expect fun deprecatedFunctionWithCustomizedAnnotation14() + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = arrayOf("org.sample.foo"))) expect fun deprecatedFunctionWithCustomizedAnnotation15() + @Deprecated("This function is deprecated") expect fun deprecatedFunctionWithCustomizedAnnotation16() + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("foo()", imports = arrayOf("org.sample.foo"))) - fun deprecatedFunctionWithCustomizedAnnotation17() {} + fun deprecatedFunctionWithCustomizedAnnotation17() { + } + @Deprecated("This function is deprecated") - fun deprecatedFunctionWithCustomizedAnnotation18() {} + fun deprecatedFunctionWithCustomizedAnnotation18() { + } + @Deprecated("This function is deprecated") - fun deprecatedFunctionWithCustomizedAnnotation19() {} + fun deprecatedFunctionWithCustomizedAnnotation19() { + } expect fun nonDeprecatedFunction1() } diff --git a/native/commonizer/testData/functionCommonization/annotations/commonized/js/package_root.kt b/native/commonizer/testData/functionCommonization/annotations/commonized/js/package_root.kt index 33068c11803..d54fd834a6e 100644 --- a/native/commonizer/testData/functionCommonization/annotations/commonized/js/package_root.kt +++ b/native/commonizer/testData/functionCommonization/annotations/commonized/js/package_root.kt @@ -1,47 +1,87 @@ actual class Holder actual constructor() { @Deprecated("This function is deprecated") - actual fun deprecatedFunction1() {} - @Deprecated("This function is deprecated") - fun deprecatedFunction2() {} + actual fun deprecatedFunction1() { + } @Deprecated("This function is deprecated") - actual fun deprecatedFunctionWithCustomizedAnnotation1() {} + fun deprecatedFunction2() { + } + @Deprecated("This function is deprecated") - actual fun deprecatedFunctionWithCustomizedAnnotation2() {} + actual fun deprecatedFunctionWithCustomizedAnnotation1() { + } + + @Deprecated("This function is deprecated") + actual fun deprecatedFunctionWithCustomizedAnnotation2() { + } + @Deprecated("This function is deprecated", level = DeprecationLevel.WARNING) - actual fun deprecatedFunctionWithCustomizedAnnotation3() {} + actual fun deprecatedFunctionWithCustomizedAnnotation3() { + } + @Deprecated("This function is deprecated") - actual fun deprecatedFunctionWithCustomizedAnnotation4() {} + actual fun deprecatedFunctionWithCustomizedAnnotation4() { + } + @Deprecated("This function is deprecated") - actual fun deprecatedFunctionWithCustomizedAnnotation5() {} + actual fun deprecatedFunctionWithCustomizedAnnotation5() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("")) - actual fun deprecatedFunctionWithCustomizedAnnotation6() {} + actual fun deprecatedFunctionWithCustomizedAnnotation6() { + } + @Deprecated("This function is deprecated") - actual fun deprecatedFunctionWithCustomizedAnnotation7() {} + actual fun deprecatedFunctionWithCustomizedAnnotation7() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("")) - actual fun deprecatedFunctionWithCustomizedAnnotation8() {} + actual fun deprecatedFunctionWithCustomizedAnnotation8() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = emptyArray())) - actual fun deprecatedFunctionWithCustomizedAnnotation9() {} + actual fun deprecatedFunctionWithCustomizedAnnotation9() { + } + @Deprecated("This function is deprecated") - actual fun deprecatedFunctionWithCustomizedAnnotation10() {} + actual fun deprecatedFunctionWithCustomizedAnnotation10() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("foo()")) - actual fun deprecatedFunctionWithCustomizedAnnotation11() {} + actual fun deprecatedFunctionWithCustomizedAnnotation11() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("bar()")) - actual fun deprecatedFunctionWithCustomizedAnnotation12() {} + actual fun deprecatedFunctionWithCustomizedAnnotation12() { + } + @Deprecated("This function is deprecated") - actual fun deprecatedFunctionWithCustomizedAnnotation13() {} + actual fun deprecatedFunctionWithCustomizedAnnotation13() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("")) - actual fun deprecatedFunctionWithCustomizedAnnotation14() {} + actual fun deprecatedFunctionWithCustomizedAnnotation14() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = arrayOf("org.sample.foo"))) - actual fun deprecatedFunctionWithCustomizedAnnotation15() {} + actual fun deprecatedFunctionWithCustomizedAnnotation15() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = arrayOf("org.sample.bar"))) - actual fun deprecatedFunctionWithCustomizedAnnotation16() {} + actual fun deprecatedFunctionWithCustomizedAnnotation16() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("foo()", imports = arrayOf("org.sample.foo"))) - actual fun deprecatedFunctionWithCustomizedAnnotation17() {} + actual fun deprecatedFunctionWithCustomizedAnnotation17() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("foo()", imports = arrayOf("org.sample.bar"))) - actual fun deprecatedFunctionWithCustomizedAnnotation18() {} + actual fun deprecatedFunctionWithCustomizedAnnotation18() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("bar()", imports = arrayOf("org.sample.foo"))) - actual fun deprecatedFunctionWithCustomizedAnnotation19() {} + actual fun deprecatedFunctionWithCustomizedAnnotation19() { + } actual fun nonDeprecatedFunction1() {} fun nonDeprecatedFunction2() {} diff --git a/native/commonizer/testData/functionCommonization/annotations/commonized/jvm/package_root.kt b/native/commonizer/testData/functionCommonization/annotations/commonized/jvm/package_root.kt index 4661283164e..8a384f91d40 100644 --- a/native/commonizer/testData/functionCommonization/annotations/commonized/jvm/package_root.kt +++ b/native/commonizer/testData/functionCommonization/annotations/commonized/jvm/package_root.kt @@ -1,47 +1,87 @@ actual class Holder actual constructor() { @Deprecated("This function is deprecated") - actual fun deprecatedFunction1() {} + actual fun deprecatedFunction1() { + } + @Deprecated("This function is deprecated") - fun deprecatedFunction3() {} + fun deprecatedFunction3() { + } @Deprecated("This function is deprecated as well") - actual fun deprecatedFunctionWithCustomizedAnnotation1() {} + actual fun deprecatedFunctionWithCustomizedAnnotation1() { + } + @Deprecated("This function is deprecated", level = DeprecationLevel.WARNING) - actual fun deprecatedFunctionWithCustomizedAnnotation2() {} + actual fun deprecatedFunctionWithCustomizedAnnotation2() { + } + @Deprecated("This function is deprecated", level = DeprecationLevel.WARNING) - actual fun deprecatedFunctionWithCustomizedAnnotation3() {} + actual fun deprecatedFunctionWithCustomizedAnnotation3() { + } + @Deprecated("This function is deprecated", level = DeprecationLevel.ERROR) - actual fun deprecatedFunctionWithCustomizedAnnotation4() {} + actual fun deprecatedFunctionWithCustomizedAnnotation4() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("")) - actual fun deprecatedFunctionWithCustomizedAnnotation5() {} + actual fun deprecatedFunctionWithCustomizedAnnotation5() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("")) - actual fun deprecatedFunctionWithCustomizedAnnotation6() {} + actual fun deprecatedFunctionWithCustomizedAnnotation6() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = emptyArray())) - actual fun deprecatedFunctionWithCustomizedAnnotation7() {} + actual fun deprecatedFunctionWithCustomizedAnnotation7() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = emptyArray())) - actual fun deprecatedFunctionWithCustomizedAnnotation8() {} + actual fun deprecatedFunctionWithCustomizedAnnotation8() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = emptyArray())) - actual fun deprecatedFunctionWithCustomizedAnnotation9() {} + actual fun deprecatedFunctionWithCustomizedAnnotation9() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("foo()")) - actual fun deprecatedFunctionWithCustomizedAnnotation10() {} + actual fun deprecatedFunctionWithCustomizedAnnotation10() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("foo()")) - actual fun deprecatedFunctionWithCustomizedAnnotation11() {} + actual fun deprecatedFunctionWithCustomizedAnnotation11() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("foo()")) - actual fun deprecatedFunctionWithCustomizedAnnotation12() {} + actual fun deprecatedFunctionWithCustomizedAnnotation12() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = arrayOf("org.sample.foo"))) - actual fun deprecatedFunctionWithCustomizedAnnotation13() {} + actual fun deprecatedFunctionWithCustomizedAnnotation13() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = arrayOf("org.sample.foo"))) - actual fun deprecatedFunctionWithCustomizedAnnotation14() {} + actual fun deprecatedFunctionWithCustomizedAnnotation14() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = arrayOf("org.sample.foo"))) - actual fun deprecatedFunctionWithCustomizedAnnotation15() {} + actual fun deprecatedFunctionWithCustomizedAnnotation15() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = arrayOf("org.sample.foo"))) - actual fun deprecatedFunctionWithCustomizedAnnotation16() {} + actual fun deprecatedFunctionWithCustomizedAnnotation16() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("foo()", imports = arrayOf("org.sample.foo"))) - actual fun deprecatedFunctionWithCustomizedAnnotation17() {} + actual fun deprecatedFunctionWithCustomizedAnnotation17() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("foo()", imports = arrayOf("org.sample.foo"))) - actual fun deprecatedFunctionWithCustomizedAnnotation18() {} + actual fun deprecatedFunctionWithCustomizedAnnotation18() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("foo()", imports = arrayOf("org.sample.foo"))) - actual fun deprecatedFunctionWithCustomizedAnnotation19() {} + actual fun deprecatedFunctionWithCustomizedAnnotation19() { + } actual fun nonDeprecatedFunction1() {} fun nonDeprecatedFunction3() {} diff --git a/native/commonizer/testData/functionCommonization/annotations/original/js/package_root.kt b/native/commonizer/testData/functionCommonization/annotations/original/js/package_root.kt index 84376d32918..780a7a77cbf 100644 --- a/native/commonizer/testData/functionCommonization/annotations/original/js/package_root.kt +++ b/native/commonizer/testData/functionCommonization/annotations/original/js/package_root.kt @@ -1,52 +1,95 @@ @Deprecated("This function is deprecated") -fun deprecatedFunction1() {} +fun deprecatedFunction1() { +} + @Deprecated("This function is deprecated") -fun deprecatedFunction2() {} +fun deprecatedFunction2() { +} class Holder { @Deprecated("This function is deprecated") - fun deprecatedFunction1() {} - @Deprecated("This function is deprecated") - fun deprecatedFunction2() {} + fun deprecatedFunction1() { + } @Deprecated("This function is deprecated") - fun deprecatedFunctionWithCustomizedAnnotation1() {} + fun deprecatedFunction2() { + } + @Deprecated("This function is deprecated") - fun deprecatedFunctionWithCustomizedAnnotation2() {} + fun deprecatedFunctionWithCustomizedAnnotation1() { + } + + @Deprecated("This function is deprecated") + fun deprecatedFunctionWithCustomizedAnnotation2() { + } + @Deprecated("This function is deprecated", level = DeprecationLevel.WARNING) - fun deprecatedFunctionWithCustomizedAnnotation3() {} + fun deprecatedFunctionWithCustomizedAnnotation3() { + } + @Deprecated("This function is deprecated") - fun deprecatedFunctionWithCustomizedAnnotation4() {} + fun deprecatedFunctionWithCustomizedAnnotation4() { + } + @Deprecated("This function is deprecated") - fun deprecatedFunctionWithCustomizedAnnotation5() {} + fun deprecatedFunctionWithCustomizedAnnotation5() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("")) - fun deprecatedFunctionWithCustomizedAnnotation6() {} + fun deprecatedFunctionWithCustomizedAnnotation6() { + } + @Deprecated("This function is deprecated") - fun deprecatedFunctionWithCustomizedAnnotation7() {} + fun deprecatedFunctionWithCustomizedAnnotation7() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("")) - fun deprecatedFunctionWithCustomizedAnnotation8() {} + fun deprecatedFunctionWithCustomizedAnnotation8() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = emptyArray())) - fun deprecatedFunctionWithCustomizedAnnotation9() {} + fun deprecatedFunctionWithCustomizedAnnotation9() { + } + @Deprecated("This function is deprecated") - fun deprecatedFunctionWithCustomizedAnnotation10() {} + fun deprecatedFunctionWithCustomizedAnnotation10() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("foo()")) - fun deprecatedFunctionWithCustomizedAnnotation11() {} + fun deprecatedFunctionWithCustomizedAnnotation11() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("bar()")) - fun deprecatedFunctionWithCustomizedAnnotation12() {} + fun deprecatedFunctionWithCustomizedAnnotation12() { + } + @Deprecated("This function is deprecated") - fun deprecatedFunctionWithCustomizedAnnotation13() {} + fun deprecatedFunctionWithCustomizedAnnotation13() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("")) - fun deprecatedFunctionWithCustomizedAnnotation14() {} + fun deprecatedFunctionWithCustomizedAnnotation14() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = arrayOf("org.sample.foo"))) - fun deprecatedFunctionWithCustomizedAnnotation15() {} + fun deprecatedFunctionWithCustomizedAnnotation15() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = arrayOf("org.sample.bar"))) - fun deprecatedFunctionWithCustomizedAnnotation16() {} + fun deprecatedFunctionWithCustomizedAnnotation16() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("foo()", imports = arrayOf("org.sample.foo"))) - fun deprecatedFunctionWithCustomizedAnnotation17() {} + fun deprecatedFunctionWithCustomizedAnnotation17() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("foo()", imports = arrayOf("org.sample.bar"))) - fun deprecatedFunctionWithCustomizedAnnotation18() {} + fun deprecatedFunctionWithCustomizedAnnotation18() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("bar()", imports = arrayOf("org.sample.foo"))) - fun deprecatedFunctionWithCustomizedAnnotation19() {} + fun deprecatedFunctionWithCustomizedAnnotation19() { + } fun nonDeprecatedFunction1() {} fun nonDeprecatedFunction2() {} diff --git a/native/commonizer/testData/functionCommonization/annotations/original/jvm/package_root.kt b/native/commonizer/testData/functionCommonization/annotations/original/jvm/package_root.kt index 8eb18b4dae0..31d210da1dc 100644 --- a/native/commonizer/testData/functionCommonization/annotations/original/jvm/package_root.kt +++ b/native/commonizer/testData/functionCommonization/annotations/original/jvm/package_root.kt @@ -1,52 +1,95 @@ @Deprecated("This function is deprecated") -fun deprecatedFunction1() {} +fun deprecatedFunction1() { +} + @Deprecated("This function is deprecated") -fun deprecatedFunction3() {} +fun deprecatedFunction3() { +} class Holder { @Deprecated("This function is deprecated") - fun deprecatedFunction1() {} + fun deprecatedFunction1() { + } + @Deprecated("This function is deprecated") - fun deprecatedFunction3() {} + fun deprecatedFunction3() { + } @Deprecated("This function is deprecated as well") - fun deprecatedFunctionWithCustomizedAnnotation1() {} + fun deprecatedFunctionWithCustomizedAnnotation1() { + } + @Deprecated("This function is deprecated", level = DeprecationLevel.WARNING) - fun deprecatedFunctionWithCustomizedAnnotation2() {} + fun deprecatedFunctionWithCustomizedAnnotation2() { + } + @Deprecated("This function is deprecated", level = DeprecationLevel.WARNING) - fun deprecatedFunctionWithCustomizedAnnotation3() {} + fun deprecatedFunctionWithCustomizedAnnotation3() { + } + @Deprecated("This function is deprecated", level = DeprecationLevel.ERROR) - fun deprecatedFunctionWithCustomizedAnnotation4() {} + fun deprecatedFunctionWithCustomizedAnnotation4() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("")) - fun deprecatedFunctionWithCustomizedAnnotation5() {} + fun deprecatedFunctionWithCustomizedAnnotation5() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("")) - fun deprecatedFunctionWithCustomizedAnnotation6() {} + fun deprecatedFunctionWithCustomizedAnnotation6() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = emptyArray())) - fun deprecatedFunctionWithCustomizedAnnotation7() {} + fun deprecatedFunctionWithCustomizedAnnotation7() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = emptyArray())) - fun deprecatedFunctionWithCustomizedAnnotation8() {} + fun deprecatedFunctionWithCustomizedAnnotation8() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = emptyArray())) - fun deprecatedFunctionWithCustomizedAnnotation9() {} + fun deprecatedFunctionWithCustomizedAnnotation9() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("foo()")) - fun deprecatedFunctionWithCustomizedAnnotation10() {} + fun deprecatedFunctionWithCustomizedAnnotation10() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("foo()")) - fun deprecatedFunctionWithCustomizedAnnotation11() {} + fun deprecatedFunctionWithCustomizedAnnotation11() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("foo()")) - fun deprecatedFunctionWithCustomizedAnnotation12() {} + fun deprecatedFunctionWithCustomizedAnnotation12() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = arrayOf("org.sample.foo"))) - fun deprecatedFunctionWithCustomizedAnnotation13() {} + fun deprecatedFunctionWithCustomizedAnnotation13() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = arrayOf("org.sample.foo"))) - fun deprecatedFunctionWithCustomizedAnnotation14() {} + fun deprecatedFunctionWithCustomizedAnnotation14() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = arrayOf("org.sample.foo"))) - fun deprecatedFunctionWithCustomizedAnnotation15() {} + fun deprecatedFunctionWithCustomizedAnnotation15() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("", imports = arrayOf("org.sample.foo"))) - fun deprecatedFunctionWithCustomizedAnnotation16() {} + fun deprecatedFunctionWithCustomizedAnnotation16() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("foo()", imports = arrayOf("org.sample.foo"))) - fun deprecatedFunctionWithCustomizedAnnotation17() {} + fun deprecatedFunctionWithCustomizedAnnotation17() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("foo()", imports = arrayOf("org.sample.foo"))) - fun deprecatedFunctionWithCustomizedAnnotation18() {} + fun deprecatedFunctionWithCustomizedAnnotation18() { + } + @Deprecated("This function is deprecated", replaceWith = ReplaceWith("foo()", imports = arrayOf("org.sample.foo"))) - fun deprecatedFunctionWithCustomizedAnnotation19() {} + fun deprecatedFunctionWithCustomizedAnnotation19() { + } fun nonDeprecatedFunction1() {} fun nonDeprecatedFunction3() {} diff --git a/native/commonizer/testData/functionCommonization/signaturesWithNullableTypealiases/commonized/js/package_root.kt b/native/commonizer/testData/functionCommonization/signaturesWithNullableTypealiases/commonized/js/package_root.kt index eab6a1203c8..d0e50560108 100644 --- a/native/commonizer/testData/functionCommonization/signaturesWithNullableTypealiases/commonized/js/package_root.kt +++ b/native/commonizer/testData/functionCommonization/signaturesWithNullableTypealiases/commonized/js/package_root.kt @@ -1,3 +1,3 @@ actual class Foo actual constructor() -actual fun bar(x: TypeAlias?) { } \ No newline at end of file +actual fun bar(x: TypeAlias?) {} diff --git a/native/commonizer/testData/functionCommonization/signaturesWithNullableTypealiases/commonized/jvm/package_root.kt b/native/commonizer/testData/functionCommonization/signaturesWithNullableTypealiases/commonized/jvm/package_root.kt index eab6a1203c8..d0e50560108 100644 --- a/native/commonizer/testData/functionCommonization/signaturesWithNullableTypealiases/commonized/jvm/package_root.kt +++ b/native/commonizer/testData/functionCommonization/signaturesWithNullableTypealiases/commonized/jvm/package_root.kt @@ -1,3 +1,3 @@ actual class Foo actual constructor() -actual fun bar(x: TypeAlias?) { } \ No newline at end of file +actual fun bar(x: TypeAlias?) {} diff --git a/native/commonizer/testData/functionCommonization/signaturesWithNullableTypealiases/original/js/package_root.kt b/native/commonizer/testData/functionCommonization/signaturesWithNullableTypealiases/original/js/package_root.kt index 99ff5d3cd74..1854ec9d8b2 100644 --- a/native/commonizer/testData/functionCommonization/signaturesWithNullableTypealiases/original/js/package_root.kt +++ b/native/commonizer/testData/functionCommonization/signaturesWithNullableTypealiases/original/js/package_root.kt @@ -2,4 +2,4 @@ class Foo typealias TypeAlias = Foo -fun bar(x: TypeAlias?) { } \ No newline at end of file +fun bar(x: TypeAlias?) {} diff --git a/native/commonizer/testData/functionCommonization/signaturesWithNullableTypealiases/original/jvm/package_root.kt b/native/commonizer/testData/functionCommonization/signaturesWithNullableTypealiases/original/jvm/package_root.kt index 99ff5d3cd74..1854ec9d8b2 100644 --- a/native/commonizer/testData/functionCommonization/signaturesWithNullableTypealiases/original/jvm/package_root.kt +++ b/native/commonizer/testData/functionCommonization/signaturesWithNullableTypealiases/original/jvm/package_root.kt @@ -2,4 +2,4 @@ class Foo typealias TypeAlias = Foo -fun bar(x: TypeAlias?) { } \ No newline at end of file +fun bar(x: TypeAlias?) {} diff --git a/native/commonizer/testData/functionCommonization/valueParameters/commonized/common/package_root.kt b/native/commonizer/testData/functionCommonization/valueParameters/commonized/common/package_root.kt index 61b19c0a19b..c0908009ef2 100644 --- a/native/commonizer/testData/functionCommonization/valueParameters/commonized/common/package_root.kt +++ b/native/commonizer/testData/functionCommonization/valueParameters/commonized/common/package_root.kt @@ -8,54 +8,73 @@ expect fun functionMismatchedParameterNames1(arg0: Int) // hasStableParameterNames=false expect fun functionMismatchedParameterNames2(arg0: Int, arg1: String) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames3(arg0: Int, arg1: String) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames4(arg0: Int, arg1: String) // hasStableParameterNames=false expect fun functionMismatchedParameterNames5(arg0: Int, arg1: String, arg2: List) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames6(arg0: Int, arg1: String, arg2: List) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames7(arg0: Int, arg1: String, arg2: List) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames8(arg0: Int, arg1: String, arg2: List) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames9(arg0: Int, arg1: String, arg2: List) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames10(arg0: Int, arg1: String, arg2: List) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames11(arg0: Int, arg1: String, arg2: List) // hasStableParameterNames=false expect fun functionMismatchedParameterNames12(vararg variadicArguments: Int) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames13(arg0: Int, vararg variadicArguments: Int) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames14(arg0: Int, vararg variadicArguments: Int) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames15(arg0: Int, vararg variadicArguments: Int) // hasStableParameterNames=false expect fun functionMismatchedParameterNames16(i: Int) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames17(i: Int, s: String) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames18(i: Int, s: String, l: List) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames19(vararg v: Int) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames20(i: Int, vararg v: Int) // hasStableParameterNames=false expect fun functionMismatchedParameterNames21(i: Int) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames22(i: Int, s: String) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames23(i: Int, s: String, l: List) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames24(vararg v: Int) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames25(i: Int, vararg v: Int) @@ -72,15 +91,19 @@ expect fun functionMismatchedParameterNames37(arg0: Int, arg1: String) // hasStableParameterNames=false expect fun functionMismatchedParameterNames38(i: Int, s: String) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames39(i: Int, s: String) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames40(i: Int, s: String) // hasStableParameterNames=false expect fun functionMismatchedParameterNames41(arg0: Int, arg1: String) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames42(arg0: Int, arg1: String) + // hasStableParameterNames=false expect fun functionMismatchedParameterNames43(arg0: Int, arg1: String) diff --git a/native/commonizer/testData/functionCommonization/valueParameters/commonized/ios/package_root.kt b/native/commonizer/testData/functionCommonization/valueParameters/commonized/ios/package_root.kt index 0fe7de2fc7d..0ab107a4388 100644 --- a/native/commonizer/testData/functionCommonization/valueParameters/commonized/ios/package_root.kt +++ b/native/commonizer/testData/functionCommonization/valueParameters/commonized/ios/package_root.kt @@ -8,32 +8,43 @@ actual fun functionMismatchedParameterNames1(arg0: Int) {} // hasStableParameterNames=false actual fun functionMismatchedParameterNames2(arg0: Int, arg1: String) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames3(arg0: Int, arg1: String) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames4(arg0: Int, arg1: String) {} // hasStableParameterNames=false actual fun functionMismatchedParameterNames5(arg0: Int, arg1: String, arg2: List) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames6(arg0: Int, arg1: String, arg2: List) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames7(arg0: Int, arg1: String, arg2: List) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames8(arg0: Int, arg1: String, arg2: List) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames9(arg0: Int, arg1: String, arg2: List) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames10(arg0: Int, arg1: String, arg2: List) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames11(arg0: Int, arg1: String, arg2: List) {} // hasStableParameterNames=false actual fun functionMismatchedParameterNames12(vararg variadicArguments: Int) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames13(arg0: Int, vararg variadicArguments: Int) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames14(arg0: Int, vararg variadicArguments: Int) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames15(arg0: Int, vararg variadicArguments: Int) {} @@ -45,12 +56,16 @@ actual fun functionMismatchedParameterNames20(i: Int, vararg v: Int) {} // hasStableParameterNames=false actual fun functionMismatchedParameterNames21(i: Int) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames22(i: Int, s: String) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames23(i: Int, s: String, l: List) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames24(vararg v: Int) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames25(i: Int, vararg v: Int) {} @@ -61,41 +76,64 @@ actual fun functionMismatchedParameterNames29(vararg variadicArguments: Int) {} actual fun functionMismatchedParameterNames30(arg0: Int, vararg variadicArguments: Int) {} actual fun functionMismatchedParameterNames31(i: Int, s: String) {} + @kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames32(i: Int, s: String) {} +fun functionMismatchedParameterNames32(i: Int, s: String) { +} + fun functionMismatchedParameterNames33(i: Int, s: String) {} -@kotlinx.cinterop.ObjCMethod -actual fun functionMismatchedParameterNames34(i: Int, s: String) {} @kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames35(i: Int, s: String) {} +actual fun functionMismatchedParameterNames34(i: Int, s: String) { +} + @kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames36(arg0: Int, arg1: String) {} +fun functionMismatchedParameterNames35(i: Int, s: String) { +} + @kotlinx.cinterop.ObjCMethod -actual fun functionMismatchedParameterNames37(arg0: Int, arg1: String) {} +fun functionMismatchedParameterNames36(arg0: Int, arg1: String) { +} + +@kotlinx.cinterop.ObjCMethod +actual fun functionMismatchedParameterNames37(arg0: Int, arg1: String) { +} // hasStableParameterNames=false @kotlinx.cinterop.ObjCMethod -actual fun functionMismatchedParameterNames38(i: Int, s: String) {} +actual fun functionMismatchedParameterNames38(i: Int, s: String) { +} + @kotlinx.cinterop.ObjCMethod -actual fun functionMismatchedParameterNames39(i: Int, s: String) {} -// hasStableParameterNames=false -@kotlinx.cinterop.ObjCMethod -actual fun functionMismatchedParameterNames40(i: Int, s: String) {} +actual fun functionMismatchedParameterNames39(i: Int, s: String) { +} // hasStableParameterNames=false @kotlinx.cinterop.ObjCMethod -actual fun functionMismatchedParameterNames41(arg0: Int, arg1: String) {} -@kotlinx.cinterop.ObjCMethod -actual fun functionMismatchedParameterNames42(arg0: Int, arg1: String) {} +actual fun functionMismatchedParameterNames40(i: Int, s: String) { +} + // hasStableParameterNames=false @kotlinx.cinterop.ObjCMethod -actual fun functionMismatchedParameterNames43(arg0: Int, arg1: String) {} +actual fun functionMismatchedParameterNames41(arg0: Int, arg1: String) { +} @kotlinx.cinterop.ObjCMethod -actual fun overloadedFunctionByParameterNames(i: Int, s: String) {} +actual fun functionMismatchedParameterNames42(arg0: Int, arg1: String) { +} + +// hasStableParameterNames=false @kotlinx.cinterop.ObjCMethod -actual fun overloadedFunctionByParameterNames(xi: Int, xs: String) {} +actual fun functionMismatchedParameterNames43(arg0: Int, arg1: String) { +} + +@kotlinx.cinterop.ObjCMethod +actual fun overloadedFunctionByParameterNames(i: Int, s: String) { +} + +@kotlinx.cinterop.ObjCMethod +actual fun overloadedFunctionByParameterNames(xi: Int, xs: String) { +} fun functionMismatchedParameterCount1(i: Int, s: String) {} fun functionMismatchedParameterCount2(i: Int, s: String, l: List) {} diff --git a/native/commonizer/testData/functionCommonization/valueParameters/commonized/macos/package_root.kt b/native/commonizer/testData/functionCommonization/valueParameters/commonized/macos/package_root.kt index d46c31fadb3..834ff626d95 100644 --- a/native/commonizer/testData/functionCommonization/valueParameters/commonized/macos/package_root.kt +++ b/native/commonizer/testData/functionCommonization/valueParameters/commonized/macos/package_root.kt @@ -8,43 +8,58 @@ actual fun functionMismatchedParameterNames1(arg0: Int) {} // hasStableParameterNames=false actual fun functionMismatchedParameterNames2(arg0: Int, arg1: String) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames3(arg0: Int, arg1: String) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames4(arg0: Int, arg1: String) {} // hasStableParameterNames=false actual fun functionMismatchedParameterNames5(arg0: Int, arg1: String, arg2: List) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames6(arg0: Int, arg1: String, arg2: List) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames7(arg0: Int, arg1: String, arg2: List) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames8(arg0: Int, arg1: String, arg2: List) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames9(arg0: Int, arg1: String, arg2: List) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames10(arg0: Int, arg1: String, arg2: List) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames11(arg0: Int, arg1: String, arg2: List) {} // hasStableParameterNames=false actual fun functionMismatchedParameterNames12(vararg variadicArguments: Int) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames13(arg0: Int, vararg variadicArguments: Int) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames14(arg0: Int, vararg variadicArguments: Int) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames15(arg0: Int, vararg variadicArguments: Int) {} // hasStableParameterNames=false actual fun functionMismatchedParameterNames16(i: Int) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames17(i: Int, s: String) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames18(i: Int, s: String, l: List) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames19(vararg v: Int) {} + // hasStableParameterNames=false actual fun functionMismatchedParameterNames20(i: Int, vararg v: Int) {} @@ -62,40 +77,62 @@ actual fun functionMismatchedParameterNames30(arg0: Int, vararg variadicArgument actual fun functionMismatchedParameterNames31(i: Int, s: String) {} fun functionMismatchedParameterNames32(i: Int, s: String) {} -@kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames33(i: Int, s: String) {} -@kotlinx.cinterop.ObjCMethod -actual fun functionMismatchedParameterNames34(i: Int, s: String) {} @kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames35(arg0: Int, arg1: String) {} -@kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames36(i: Int, s: String) {} -@kotlinx.cinterop.ObjCMethod -actual fun functionMismatchedParameterNames37(arg0: Int, arg1: String) {} +fun functionMismatchedParameterNames33(i: Int, s: String) { +} @kotlinx.cinterop.ObjCMethod -actual fun functionMismatchedParameterNames38(i: Int, s: String) {} -// hasStableParameterNames=false -@kotlinx.cinterop.ObjCMethod -actual fun functionMismatchedParameterNames39(i: Int, s: String) {} -// hasStableParameterNames=false -@kotlinx.cinterop.ObjCMethod -actual fun functionMismatchedParameterNames40(i: Int, s: String) {} +actual fun functionMismatchedParameterNames34(i: Int, s: String) { +} @kotlinx.cinterop.ObjCMethod -actual fun functionMismatchedParameterNames41(arg0: Int, arg1: String) {} -// hasStableParameterNames=false -@kotlinx.cinterop.ObjCMethod -actual fun functionMismatchedParameterNames42(arg0: Int, arg1: String) {} -// hasStableParameterNames=false -@kotlinx.cinterop.ObjCMethod -actual fun functionMismatchedParameterNames43(arg0: Int, arg1: String) {} +fun functionMismatchedParameterNames35(arg0: Int, arg1: String) { +} @kotlinx.cinterop.ObjCMethod -actual fun overloadedFunctionByParameterNames(i: Int, s: String) {} +fun functionMismatchedParameterNames36(i: Int, s: String) { +} + @kotlinx.cinterop.ObjCMethod -actual fun overloadedFunctionByParameterNames(xi: Int, xs: String) {} +actual fun functionMismatchedParameterNames37(arg0: Int, arg1: String) { +} + +@kotlinx.cinterop.ObjCMethod +actual fun functionMismatchedParameterNames38(i: Int, s: String) { +} + +// hasStableParameterNames=false +@kotlinx.cinterop.ObjCMethod +actual fun functionMismatchedParameterNames39(i: Int, s: String) { +} + +// hasStableParameterNames=false +@kotlinx.cinterop.ObjCMethod +actual fun functionMismatchedParameterNames40(i: Int, s: String) { +} + +@kotlinx.cinterop.ObjCMethod +actual fun functionMismatchedParameterNames41(arg0: Int, arg1: String) { +} + +// hasStableParameterNames=false +@kotlinx.cinterop.ObjCMethod +actual fun functionMismatchedParameterNames42(arg0: Int, arg1: String) { +} + +// hasStableParameterNames=false +@kotlinx.cinterop.ObjCMethod +actual fun functionMismatchedParameterNames43(arg0: Int, arg1: String) { +} + +@kotlinx.cinterop.ObjCMethod +actual fun overloadedFunctionByParameterNames(i: Int, s: String) { +} + +@kotlinx.cinterop.ObjCMethod +actual fun overloadedFunctionByParameterNames(xi: Int, xs: String) { +} fun functionMismatchedParameterCount1(i: Int, s: String, l: List) {} fun functionMismatchedParameterCount2(i: Int, s: String) {} diff --git a/native/commonizer/testData/functionCommonization/valueParameters/original/ios/package_root.kt b/native/commonizer/testData/functionCommonization/valueParameters/original/ios/package_root.kt index 6fc8ecac0a5..1106353d94b 100644 --- a/native/commonizer/testData/functionCommonization/valueParameters/original/ios/package_root.kt +++ b/native/commonizer/testData/functionCommonization/valueParameters/original/ios/package_root.kt @@ -41,41 +41,64 @@ fun functionMismatchedParameterNames29(vararg variadicArguments: Int) {} fun functionMismatchedParameterNames30(arg0: Int, vararg variadicArguments: Int) {} fun functionMismatchedParameterNames31(i: Int, s: String) {} + @kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames32(i: Int, s: String) {} +fun functionMismatchedParameterNames32(i: Int, s: String) { +} + fun functionMismatchedParameterNames33(i: Int, s: String) {} -@kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames34(i: Int, s: String) {} @kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames35(i: Int, s: String) {} +fun functionMismatchedParameterNames34(i: Int, s: String) { +} + @kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames36(arg0: Int, arg1: String) {} +fun functionMismatchedParameterNames35(i: Int, s: String) { +} + @kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames37(arg0: Int, arg1: String) {} +fun functionMismatchedParameterNames36(arg0: Int, arg1: String) { +} + +@kotlinx.cinterop.ObjCMethod +fun functionMismatchedParameterNames37(arg0: Int, arg1: String) { +} // hasStableParameterNames=false @kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames38(i: Int, s: String) {} +fun functionMismatchedParameterNames38(i: Int, s: String) { +} + @kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames39(i: Int, s: String) {} -// hasStableParameterNames=false -@kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames40(i: Int, s: String) {} +fun functionMismatchedParameterNames39(i: Int, s: String) { +} // hasStableParameterNames=false @kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames41(arg0: Int, arg1: String) {} -@kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames42(arg0: Int, arg1: String) {} +fun functionMismatchedParameterNames40(i: Int, s: String) { +} + // hasStableParameterNames=false @kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames43(arg0: Int, arg1: String) {} +fun functionMismatchedParameterNames41(arg0: Int, arg1: String) { +} @kotlinx.cinterop.ObjCMethod -fun overloadedFunctionByParameterNames(i: Int, s: String) {} +fun functionMismatchedParameterNames42(arg0: Int, arg1: String) { +} + +// hasStableParameterNames=false @kotlinx.cinterop.ObjCMethod -fun overloadedFunctionByParameterNames(xi: Int, xs: String) {} +fun functionMismatchedParameterNames43(arg0: Int, arg1: String) { +} + +@kotlinx.cinterop.ObjCMethod +fun overloadedFunctionByParameterNames(i: Int, s: String) { +} + +@kotlinx.cinterop.ObjCMethod +fun overloadedFunctionByParameterNames(xi: Int, xs: String) { +} fun functionMismatchedParameterCount1(i: Int, s: String) {} fun functionMismatchedParameterCount2(i: Int, s: String, l: List) {} diff --git a/native/commonizer/testData/functionCommonization/valueParameters/original/macos/package_root.kt b/native/commonizer/testData/functionCommonization/valueParameters/original/macos/package_root.kt index bfa09f92aef..a2400441e69 100644 --- a/native/commonizer/testData/functionCommonization/valueParameters/original/macos/package_root.kt +++ b/native/commonizer/testData/functionCommonization/valueParameters/original/macos/package_root.kt @@ -42,40 +42,62 @@ fun functionMismatchedParameterNames30(arg0: Int, vararg variadicArguments: Int) fun functionMismatchedParameterNames31(i: Int, s: String) {} fun functionMismatchedParameterNames32(i: Int, s: String) {} -@kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames33(i: Int, s: String) {} -@kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames34(i: Int, s: String) {} @kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames35(arg0: Int, arg1: String) {} -@kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames36(i: Int, s: String) {} -@kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames37(arg0: Int, arg1: String) {} +fun functionMismatchedParameterNames33(i: Int, s: String) { +} @kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames38(i: Int, s: String) {} -// hasStableParameterNames=false -@kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames39(i: Int, s: String) {} -// hasStableParameterNames=false -@kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames40(i: Int, s: String) {} +fun functionMismatchedParameterNames34(i: Int, s: String) { +} @kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames41(arg0: Int, arg1: String) {} -// hasStableParameterNames=false -@kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames42(arg0: Int, arg1: String) {} -// hasStableParameterNames=false -@kotlinx.cinterop.ObjCMethod -fun functionMismatchedParameterNames43(arg0: Int, arg1: String) {} +fun functionMismatchedParameterNames35(arg0: Int, arg1: String) { +} @kotlinx.cinterop.ObjCMethod -fun overloadedFunctionByParameterNames(i: Int, s: String) {} +fun functionMismatchedParameterNames36(i: Int, s: String) { +} + @kotlinx.cinterop.ObjCMethod -fun overloadedFunctionByParameterNames(xi: Int, xs: String) {} +fun functionMismatchedParameterNames37(arg0: Int, arg1: String) { +} + +@kotlinx.cinterop.ObjCMethod +fun functionMismatchedParameterNames38(i: Int, s: String) { +} + +// hasStableParameterNames=false +@kotlinx.cinterop.ObjCMethod +fun functionMismatchedParameterNames39(i: Int, s: String) { +} + +// hasStableParameterNames=false +@kotlinx.cinterop.ObjCMethod +fun functionMismatchedParameterNames40(i: Int, s: String) { +} + +@kotlinx.cinterop.ObjCMethod +fun functionMismatchedParameterNames41(arg0: Int, arg1: String) { +} + +// hasStableParameterNames=false +@kotlinx.cinterop.ObjCMethod +fun functionMismatchedParameterNames42(arg0: Int, arg1: String) { +} + +// hasStableParameterNames=false +@kotlinx.cinterop.ObjCMethod +fun functionMismatchedParameterNames43(arg0: Int, arg1: String) { +} + +@kotlinx.cinterop.ObjCMethod +fun overloadedFunctionByParameterNames(i: Int, s: String) { +} + +@kotlinx.cinterop.ObjCMethod +fun overloadedFunctionByParameterNames(xi: Int, xs: String) { +} fun functionMismatchedParameterCount1(i: Int, s: String, l: List) {} fun functionMismatchedParameterCount2(i: Int, s: String) {} diff --git a/native/commonizer/testData/generalCommonization/annotations/commonized/common/package_root.kt b/native/commonizer/testData/generalCommonization/annotations/commonized/common/package_root.kt index e9b848a740a..96a2cea6137 100644 --- a/native/commonizer/testData/generalCommonization/annotations/commonized/common/package_root.kt +++ b/native/commonizer/testData/generalCommonization/annotations/commonized/common/package_root.kt @@ -1,5 +1,10 @@ -expect annotation class CommonAnnotationForAnnotationClassesOnly(text: String) { val text: String } -expect annotation class CommonAnnotation(text: String) { val text: String } +expect annotation class CommonAnnotationForAnnotationClassesOnly(text: String) { + val text: String +} + +expect annotation class CommonAnnotation(text: String) { + val text: String +} expect var propertyWithoutBackingField: Double expect val propertyWithBackingField: Double @@ -9,6 +14,9 @@ expect val T.propertyWithExtensionReceiver: Int expect fun function1(text: String): String expect fun Q.function2(): Q -expect class AnnotatedClass(value: String) { val value: String } +expect class AnnotatedClass(value: String) { + val value: String +} typealias AnnotatedLiftedUpTypeAlias = AnnotatedClass + expect class AnnotatedNonLiftedUpTypeAlias diff --git a/native/commonizer/testData/generalCommonization/annotations/commonized/js/package_root.kt b/native/commonizer/testData/generalCommonization/annotations/commonized/js/package_root.kt index 825316810df..6f1ea0fde51 100644 --- a/native/commonizer/testData/generalCommonization/annotations/commonized/js/package_root.kt +++ b/native/commonizer/testData/generalCommonization/annotations/commonized/js/package_root.kt @@ -30,7 +30,13 @@ actual val propertyWithBackingField = 3.14 @delegate:CommonAnnotation("field") actual val propertyWithDelegateField: Int by lazy { 42 } -actual val <@JsAnnotation("type-parameter") @CommonAnnotation("type-parameter") T : CharSequence> @receiver:JsAnnotation("receiver") @receiver:CommonAnnotation("receiver") T.propertyWithExtensionReceiver: Int +actual val < + @JsAnnotation("type-parameter") + @CommonAnnotation("type-parameter") + T : CharSequence> + @receiver:JsAnnotation("receiver") + @receiver:CommonAnnotation("receiver") + T.propertyWithExtensionReceiver: Int get() = length @JsAnnotation("function") @@ -39,7 +45,13 @@ actual fun function1(@JsAnnotation("parameter") @CommonAnnotation("parameter") t @JsAnnotation("function") @CommonAnnotation("function") -actual fun <@JsAnnotation("type-parameter") @CommonAnnotation("type-parameter") Q : Number> @receiver:JsAnnotation("receiver") @receiver:CommonAnnotation("receiver") Q.function2(): Q = this +actual fun < + @JsAnnotation("type-parameter") + @CommonAnnotation("type-parameter") + Q : Number> + @receiver:JsAnnotation("receiver") + @receiver:CommonAnnotation("receiver") + Q.function2(): Q = this @JsAnnotation("class") @CommonAnnotation("class") diff --git a/native/commonizer/testData/generalCommonization/annotations/commonized/jvm/package_root.kt b/native/commonizer/testData/generalCommonization/annotations/commonized/jvm/package_root.kt index bbda0d83df5..aca6a394c7f 100644 --- a/native/commonizer/testData/generalCommonization/annotations/commonized/jvm/package_root.kt +++ b/native/commonizer/testData/generalCommonization/annotations/commonized/jvm/package_root.kt @@ -30,7 +30,13 @@ actual val propertyWithBackingField = 3.14 @delegate:CommonAnnotation("field") actual val propertyWithDelegateField: Int by lazy { 42 } -actual val <@JvmAnnotation("type-parameter") @CommonAnnotation("type-parameter") T : CharSequence> @receiver:JvmAnnotation("receiver") @receiver:CommonAnnotation("receiver") T.propertyWithExtensionReceiver: Int +actual val < + @JvmAnnotation("type-parameter") + @CommonAnnotation("type-parameter") + T : CharSequence> + @receiver:JvmAnnotation("receiver") + @receiver:CommonAnnotation("receiver") + T.propertyWithExtensionReceiver: Int get() = length @JvmAnnotation("function") @@ -39,7 +45,13 @@ actual fun function1(@JvmAnnotation("parameter") @CommonAnnotation("parameter") @JvmAnnotation("function") @CommonAnnotation("function") -actual fun <@JvmAnnotation("type-parameter") @CommonAnnotation("type-parameter") Q : Number> @receiver:JvmAnnotation("receiver") @receiver:CommonAnnotation("receiver") Q.function2(): Q = this +actual fun < + @JvmAnnotation("type-parameter") + @CommonAnnotation("type-parameter") + Q : Number> + @receiver:JvmAnnotation("receiver") + @receiver:CommonAnnotation("receiver") + Q.function2(): Q = this @JvmAnnotation("class") @CommonAnnotation("class") diff --git a/native/commonizer/testData/generalCommonization/annotations/original/js/package_root.kt b/native/commonizer/testData/generalCommonization/annotations/original/js/package_root.kt index 77016be8d22..7ddbfb5467e 100644 --- a/native/commonizer/testData/generalCommonization/annotations/original/js/package_root.kt +++ b/native/commonizer/testData/generalCommonization/annotations/original/js/package_root.kt @@ -30,7 +30,13 @@ val propertyWithBackingField = 3.14 @delegate:CommonAnnotation("field") val propertyWithDelegateField: Int by lazy { 42 } -val <@JsAnnotation("type-parameter") @CommonAnnotation("type-parameter") T : CharSequence> @receiver:JsAnnotation("receiver") @receiver:CommonAnnotation("receiver") T.propertyWithExtensionReceiver: Int +val < + @JsAnnotation("type-parameter") + @CommonAnnotation("type-parameter") + T : CharSequence> + @receiver:JsAnnotation("receiver") + @receiver:CommonAnnotation("receiver") + T.propertyWithExtensionReceiver: Int get() = length @JsAnnotation("function") @@ -39,7 +45,14 @@ fun function1(@JsAnnotation("parameter") @CommonAnnotation("parameter") text: St @JsAnnotation("function") @CommonAnnotation("function") -fun <@JsAnnotation("type-parameter") @CommonAnnotation("type-parameter") Q : @JsAnnotation("type1") @CommonAnnotation("type1") Number> @receiver:JsAnnotation("receiver") @receiver:CommonAnnotation("receiver") Q.function2(): @JsAnnotation("type2") @CommonAnnotation("type2") Q = this +fun < + @JsAnnotation("type-parameter") + @CommonAnnotation("type-parameter") + Q : @JsAnnotation("type1") + @CommonAnnotation("type1") Number> + @receiver:JsAnnotation("receiver") + @receiver:CommonAnnotation("receiver") + Q.function2(): @JsAnnotation("type2") @CommonAnnotation("type2") Q = this @JsAnnotation("class") @CommonAnnotation("class") diff --git a/native/commonizer/testData/generalCommonization/annotations/original/jvm/package_root.kt b/native/commonizer/testData/generalCommonization/annotations/original/jvm/package_root.kt index 91185d56ebb..7c08471baee 100644 --- a/native/commonizer/testData/generalCommonization/annotations/original/jvm/package_root.kt +++ b/native/commonizer/testData/generalCommonization/annotations/original/jvm/package_root.kt @@ -30,7 +30,13 @@ val propertyWithBackingField = 3.14 @delegate:CommonAnnotation("field") val propertyWithDelegateField: Int by lazy { 42 } -val <@JvmAnnotation("type-parameter") @CommonAnnotation("type-parameter") T : CharSequence> @receiver:JvmAnnotation("receiver") @receiver:CommonAnnotation("receiver") T.propertyWithExtensionReceiver: Int +val < + @JvmAnnotation("type-parameter") + @CommonAnnotation("type-parameter") + T : CharSequence> + @receiver:JvmAnnotation("receiver") + @receiver:CommonAnnotation("receiver") + T.propertyWithExtensionReceiver: Int get() = length @JvmAnnotation("function") @@ -39,7 +45,15 @@ fun function1(@JvmAnnotation("parameter") @CommonAnnotation("parameter") text: S @JvmAnnotation("function") @CommonAnnotation("function") -fun <@JvmAnnotation("type-parameter") @CommonAnnotation("type-parameter") Q : @JvmAnnotation("type1") @CommonAnnotation("type1") Number> @receiver:JvmAnnotation("receiver") @receiver:CommonAnnotation("receiver") Q.function2(): @JvmAnnotation("type2") @CommonAnnotation("type2") Q = this +fun < + @JvmAnnotation("type-parameter") + @CommonAnnotation("type-parameter") + Q : @JvmAnnotation("type1") + @CommonAnnotation("type1") + Number> + @receiver:JvmAnnotation("receiver") + @receiver:CommonAnnotation("receiver") + Q.function2(): @JvmAnnotation("type2") @CommonAnnotation("type2") Q = this @JvmAnnotation("class") @CommonAnnotation("class") diff --git a/native/commonizer/testData/propertyCommonization/setters/original/jvm/package_root.kt b/native/commonizer/testData/propertyCommonization/setters/original/jvm/package_root.kt index 50cccdc5b62..c4019307df1 100644 --- a/native/commonizer/testData/propertyCommonization/setters/original/jvm/package_root.kt +++ b/native/commonizer/testData/propertyCommonization/setters/original/jvm/package_root.kt @@ -1,5 +1,6 @@ var defaultSetter1 = 42 var defaultSetter2 = 42 // intentionally commented setter declaration + // set var defaultSetter3 = 42 set @@ -15,17 +16,18 @@ var setterWithDelegation2 = 42 // intentionally left without delegation var defaultSetteCustomVisibility1 = 42 public set var defaultSetteCustomVisibility2 = 42 -// internal set + // internal set public set // intentionally used public visibility var defaultSetteCustomVisibility3 = 42 internal set var defaultSetteCustomVisibility4 = 42 -// private set + // private set internal set // intentionally used internal visibility var defaultSetteCustomVisibility5 = 42 private set val propertyWithoutSetter = 42 + //var propertyMaybeSetter = 42 val propertyMaybeSetter = 42 // fixed to be a property without setter var propertyWithSetter = 42 diff --git a/native/commonizer/tests/org/jetbrains/kotlin/commonizer/core/CirNameTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/commonizer/core/CirNameTest.kt index f7d6baf61d4..55a9d158748 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/commonizer/core/CirNameTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/commonizer/core/CirNameTest.kt @@ -8,8 +8,8 @@ package org.jetbrains.kotlin.commonizer.core import org.jetbrains.kotlin.commonizer.cir.CirName import org.jetbrains.kotlin.name.Name import org.junit.Test -import kotlin.test.assertSame import kotlin.test.assertEquals +import kotlin.test.assertSame class CirNameTest { @Test diff --git a/native/commonizer/tests/org/jetbrains/kotlin/commonizer/core/EqualizingVisibilityCommonizerTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/commonizer/core/EqualizingVisibilityCommonizerTest.kt index d90b0c095be..2a9e2f7d06c 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/commonizer/core/EqualizingVisibilityCommonizerTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/commonizer/core/EqualizingVisibilityCommonizerTest.kt @@ -5,13 +5,13 @@ package org.jetbrains.kotlin.commonizer.core +import org.jetbrains.kotlin.commonizer.cir.CirHasVisibility import org.jetbrains.kotlin.descriptors.Visibilities.Internal import org.jetbrains.kotlin.descriptors.Visibilities.Local import org.jetbrains.kotlin.descriptors.Visibilities.Private import org.jetbrains.kotlin.descriptors.Visibilities.Protected import org.jetbrains.kotlin.descriptors.Visibilities.Public import org.jetbrains.kotlin.descriptors.Visibility -import org.jetbrains.kotlin.commonizer.cir.CirHasVisibility import org.junit.Test class EqualizingVisibilityCommonizerTest : AbstractCommonizerTest() { diff --git a/native/commonizer/tests/org/jetbrains/kotlin/commonizer/core/LoweringVisibilityCommonizerTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/commonizer/core/LoweringVisibilityCommonizerTest.kt index b92b4928c3e..ae0045ab250 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/commonizer/core/LoweringVisibilityCommonizerTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/commonizer/core/LoweringVisibilityCommonizerTest.kt @@ -5,6 +5,10 @@ package org.jetbrains.kotlin.commonizer.core +import org.jetbrains.kotlin.commonizer.cir.CirContainingClass +import org.jetbrains.kotlin.commonizer.cir.CirFunctionOrProperty +import org.jetbrains.kotlin.commonizer.cir.CirHasVisibility +import org.jetbrains.kotlin.commonizer.cir.unsupported import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.Visibilities.Internal @@ -13,10 +17,6 @@ import org.jetbrains.kotlin.descriptors.Visibilities.Private import org.jetbrains.kotlin.descriptors.Visibilities.Protected import org.jetbrains.kotlin.descriptors.Visibilities.Public import org.jetbrains.kotlin.descriptors.Visibility -import org.jetbrains.kotlin.commonizer.cir.CirContainingClass -import org.jetbrains.kotlin.commonizer.cir.CirFunctionOrProperty -import org.jetbrains.kotlin.commonizer.cir.CirHasVisibility -import org.jetbrains.kotlin.commonizer.cir.unsupported import org.junit.Test abstract class LoweringVisibilityCommonizerTest( diff --git a/native/commonizer/tests/org/jetbrains/kotlin/commonizer/core/PropertySetterCommonizerTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/commonizer/core/PropertySetterCommonizerTest.kt index e490a866669..356dbcf877c 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/commonizer/core/PropertySetterCommonizerTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/commonizer/core/PropertySetterCommonizerTest.kt @@ -5,13 +5,13 @@ package org.jetbrains.kotlin.commonizer.core +import org.jetbrains.kotlin.commonizer.cir.CirPropertySetter import org.jetbrains.kotlin.descriptors.Visibilities.Internal import org.jetbrains.kotlin.descriptors.Visibilities.Local import org.jetbrains.kotlin.descriptors.Visibilities.Private import org.jetbrains.kotlin.descriptors.Visibilities.Protected import org.jetbrains.kotlin.descriptors.Visibilities.Public import org.jetbrains.kotlin.descriptors.Visibility -import org.jetbrains.kotlin.commonizer.cir.CirPropertySetter import org.junit.Test class PropertySetterCommonizerTest : AbstractCommonizerTest() { diff --git a/native/commonizer/tests/org/jetbrains/kotlin/commonizer/core/TypeCommonizerTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/commonizer/core/TypeCommonizerTest.kt index 6ad2a1e4dfb..e5f5e6d969b 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/commonizer/core/TypeCommonizerTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/commonizer/core/TypeCommonizerTest.kt @@ -5,14 +5,14 @@ package org.jetbrains.kotlin.commonizer.core -import org.jetbrains.kotlin.descriptors.ClassKind -import org.jetbrains.kotlin.descriptors.Modality -import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.commonizer.cir.* import org.jetbrains.kotlin.commonizer.mergedtree.* import org.jetbrains.kotlin.commonizer.utils.isUnderStandardKotlinPackages import org.jetbrains.kotlin.commonizer.utils.mockClassType import org.jetbrains.kotlin.commonizer.utils.mockTAType +import org.jetbrains.kotlin.descriptors.ClassKind +import org.jetbrains.kotlin.descriptors.Modality +import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.storage.LockBasedStorageManager import org.junit.Before import org.junit.Test diff --git a/native/commonizer/tests/org/jetbrains/kotlin/commonizer/hierarchical/HierarchicalPropertyCommonizationTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/commonizer/hierarchical/HierarchicalPropertyCommonizationTest.kt index da5c1a235ad..77dc8f9f832 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/commonizer/hierarchical/HierarchicalPropertyCommonizationTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/commonizer/hierarchical/HierarchicalPropertyCommonizationTest.kt @@ -6,9 +6,7 @@ package org.jetbrains.kotlin.commonizer.hierarchical import org.jetbrains.kotlin.commonizer.AbstractInlineSourcesCommonizationTest -import org.jetbrains.kotlin.commonizer.SharedCommonizerTarget import org.jetbrains.kotlin.commonizer.assertCommonized -import org.jetbrains.kotlin.commonizer.parseCommonizerTarget class HierarchicalPropertyCommonizationTest : AbstractInlineSourcesCommonizationTest() {