Add KmFlexibleTypeUpperBound.Companion and JVM_PLATFORM_TYPE_ID extension on it.

Because `public JvmTypeExtensionVisitor` was removed, a new place for `const val PLATFORM_TYPE_ID`
is required. It is logical to place it as a some kind of constant for Km node;
however, because it is platform-specific, there is a need for an empty
`KmFlexibleTypeUpperBound.Companion` in metadata common sources
and `public val KmFlexibleTypeUpperBound.Companion.PLATFORM_TYPE_ID`
extension in kotlin-metadata-jvm sources.

See also: KT-63156
This commit is contained in:
Leonid Startsev
2024-03-06 20:20:19 +01:00
committed by Space Team
parent 50331fb149
commit cc343d7fb3
5 changed files with 21 additions and 10 deletions
@@ -483,6 +483,7 @@ public final class kotlin/metadata/KmEffectType : java/lang/Enum {
}
public final class kotlin/metadata/KmFlexibleTypeUpperBound {
public static final field Companion Lkotlin/metadata/KmFlexibleTypeUpperBound$Companion;
public fun <init> (Lkotlin/metadata/KmType;Ljava/lang/String;)V
public final fun component1 ()Lkotlin/metadata/KmType;
public final fun component2 ()Ljava/lang/String;
@@ -497,6 +498,9 @@ public final class kotlin/metadata/KmFlexibleTypeUpperBound {
public fun toString ()Ljava/lang/String;
}
public final class kotlin/metadata/KmFlexibleTypeUpperBound$Companion {
}
public final class kotlin/metadata/KmFunction {
public field returnType Lkotlin/metadata/KmType;
public fun <init> (Ljava/lang/String;)V
@@ -730,6 +734,7 @@ public final class kotlin/metadata/jvm/JvmExtensionsKt {
public static final fun getAnonymousObjectOriginName (Lkotlin/metadata/KmClass;)Ljava/lang/String;
public static final fun getFieldSignature (Lkotlin/metadata/KmProperty;)Lkotlin/metadata/jvm/JvmFieldSignature;
public static final fun getGetterSignature (Lkotlin/metadata/KmProperty;)Lkotlin/metadata/jvm/JvmMethodSignature;
public static final fun getJVM_PLATFORM_TYPE_ID (Lkotlin/metadata/KmFlexibleTypeUpperBound$Companion;)Ljava/lang/String;
public static final fun getLambdaClassOriginName (Lkotlin/metadata/KmFunction;)Ljava/lang/String;
public static final fun getLocalDelegatedProperties (Lkotlin/metadata/KmClass;)Ljava/util/List;
public static final fun getLocalDelegatedProperties (Lkotlin/metadata/KmPackage;)Ljava/util/List;
@@ -8,6 +8,7 @@
package kotlin.metadata.jvm
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
import kotlin.metadata.*
import kotlin.metadata.jvm.internal.jvm
@@ -172,3 +173,11 @@ public var KmType.isRaw: Boolean
*/
public val KmType.annotations: MutableList<KmAnnotation>
get() = jvm.annotations
/**
* The type flexibility id, signifying that the visited type is a JVM platform type.
*
* @see KmFlexibleTypeUpperBound.typeFlexibilityId
*/
public val KmFlexibleTypeUpperBound.Companion.JVM_PLATFORM_TYPE_ID: String get() = JvmProtoBufUtil.PLATFORM_TYPE_ID
@@ -121,12 +121,5 @@ internal class JvmTypeExtension : KmTypeExtension {
companion object {
@JvmField
val TYPE: KmExtensionType = KmExtensionType(JvmTypeExtension::class)
/**
* The type flexibility id, signifying that the visited type is a JVM platform type.
*
* @see KmTypeVisitor.visitFlexibleTypeUpperBound
*/
const val PLATFORM_TYPE_ID: String = JvmProtoBufUtil.PLATFORM_TYPE_ID // TODO: move out of deprecated visitor
}
}
@@ -588,7 +588,12 @@ public data class KmTypeProjection(var variance: KmVariance?, var type: KmType?)
* @property typeFlexibilityId id of the kind of flexibility this type has. For example, "kotlin.jvm.PlatformType" for JVM platform types,
* or "kotlin.DynamicType" for JS dynamic type
*/
public data class KmFlexibleTypeUpperBound(var type: KmType, var typeFlexibilityId: String?)
public data class KmFlexibleTypeUpperBound(var type: KmType, var typeFlexibilityId: String?) {
/**
* A companion object providing possibility to declare various platform-dependent constant ids as extension properties of it.
*/
public companion object
}
/**
* Variance applied to a type parameter on the declaration site (*declaration-site variance*),