[Commonizer] Remove CirTypeSignature from CirType
This commit is contained in:
@@ -11,9 +11,7 @@ import org.jetbrains.kotlin.types.Variance
|
||||
|
||||
typealias CirTypeSignature = String
|
||||
|
||||
sealed class CirType {
|
||||
abstract val signature: CirTypeSignature
|
||||
}
|
||||
sealed class CirType
|
||||
|
||||
/**
|
||||
* All attributes are read from the abbreviation type: [AbbreviatedType.abbreviation].
|
||||
@@ -33,9 +31,6 @@ abstract class CirSimpleType : CirType(), CirHasVisibility {
|
||||
abstract val isDefinitelyNotNullType: Boolean
|
||||
}
|
||||
|
||||
data class CirTypeProjection(val projectionKind: Variance, val isStarProjection: Boolean, val type: CirType)
|
||||
data class CirFlexibleType(val lowerBound: CirSimpleType, val upperBound: CirSimpleType) : CirType()
|
||||
|
||||
data class CirFlexibleType(val lowerBound: CirSimpleType, val upperBound: CirSimpleType) : CirType() {
|
||||
override val signature: CirTypeSignature
|
||||
get() = lowerBound.signature
|
||||
}
|
||||
data class CirTypeProjection(val projectionKind: Variance, val isStarProjection: Boolean, val type: CirType)
|
||||
|
||||
+3
-7
@@ -13,7 +13,6 @@ import org.jetbrains.kotlin.descriptors.commonizer.cir.*
|
||||
import org.jetbrains.kotlin.descriptors.commonizer.cir.impl.CirSimpleTypeImpl
|
||||
import org.jetbrains.kotlin.descriptors.commonizer.utils.Interner
|
||||
import org.jetbrains.kotlin.descriptors.commonizer.utils.declarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.commonizer.utils.signature
|
||||
import org.jetbrains.kotlin.types.*
|
||||
|
||||
object CirTypeFactory {
|
||||
@@ -41,8 +40,7 @@ object CirTypeFactory {
|
||||
)
|
||||
},
|
||||
isMarkedNullable = abbreviation.isMarkedNullable,
|
||||
isDefinitelyNotNullType = abbreviation.isDefinitelyNotNullType,
|
||||
signature = source.signature
|
||||
isDefinitelyNotNullType = abbreviation.isDefinitelyNotNullType
|
||||
)
|
||||
}
|
||||
|
||||
@@ -51,8 +49,7 @@ object CirTypeFactory {
|
||||
visibility: Visibility,
|
||||
arguments: List<CirTypeProjection>,
|
||||
isMarkedNullable: Boolean,
|
||||
isDefinitelyNotNullType: Boolean,
|
||||
signature: CirTypeSignature
|
||||
isDefinitelyNotNullType: Boolean
|
||||
): CirSimpleType {
|
||||
return interner.intern(
|
||||
CirSimpleTypeImpl(
|
||||
@@ -60,8 +57,7 @@ object CirTypeFactory {
|
||||
visibility = visibility,
|
||||
arguments = arguments,
|
||||
isMarkedNullable = isMarkedNullable,
|
||||
isDefinitelyNotNullType = isDefinitelyNotNullType,
|
||||
signature = signature
|
||||
isDefinitelyNotNullType = isDefinitelyNotNullType
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
+1
-4
@@ -15,8 +15,7 @@ data class CirSimpleTypeImpl(
|
||||
override val visibility: Visibility, // visibility of the classifier descriptor
|
||||
override val arguments: List<CirTypeProjection>,
|
||||
override val isMarkedNullable: Boolean,
|
||||
override val isDefinitelyNotNullType: Boolean,
|
||||
override val signature: CirTypeSignature
|
||||
override val isDefinitelyNotNullType: Boolean
|
||||
) : CirSimpleType() {
|
||||
// See also org.jetbrains.kotlin.types.KotlinType.cachedHashCode
|
||||
private var cachedHashCode = 0
|
||||
@@ -26,7 +25,6 @@ data class CirSimpleTypeImpl(
|
||||
.appendHashCode(arguments)
|
||||
.appendHashCode(isMarkedNullable)
|
||||
.appendHashCode(isDefinitelyNotNullType)
|
||||
.appendHashCode(signature)
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var currentHashCode = cachedHashCode
|
||||
@@ -44,7 +42,6 @@ data class CirSimpleTypeImpl(
|
||||
&& classifierId == other.classifierId
|
||||
&& visibility == other.visibility
|
||||
&& arguments == other.arguments
|
||||
&& signature == other.signature
|
||||
&& isDefinitelyNotNullType == other.isDefinitelyNotNullType
|
||||
}
|
||||
else -> false
|
||||
|
||||
+1
-2
@@ -165,8 +165,7 @@ private class DeprecatedAnnotationCommonizer : Commonizer<CirAnnotation, CirAnno
|
||||
visibility = Visibilities.PUBLIC,
|
||||
arguments = emptyList(),
|
||||
isMarkedNullable = false,
|
||||
isDefinitelyNotNullType = false,
|
||||
signature = classId.asString()
|
||||
isDefinitelyNotNullType = false
|
||||
)
|
||||
|
||||
private fun CirAnnotation.getDeprecationMessage(): String? = constantValueArguments.getString(PROPERTY_NAME_MESSAGE)
|
||||
|
||||
+2
-3
@@ -6,7 +6,6 @@
|
||||
package org.jetbrains.kotlin.descriptors.commonizer.core
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.commonizer.cir.CirType
|
||||
import org.jetbrains.kotlin.descriptors.commonizer.cir.CirTypeSignature
|
||||
import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.*
|
||||
import org.jetbrains.kotlin.descriptors.commonizer.utils.CommonizedGroup
|
||||
import org.jetbrains.kotlin.descriptors.commonizer.utils.internedClassId
|
||||
@@ -93,10 +92,10 @@ internal class CommonizationVisitor(
|
||||
}
|
||||
|
||||
// find out common (and commonized) supertypes
|
||||
val supertypesMap: MutableMap<CirTypeSignature, CommonizedGroup<CirType>> = linkedMapOf() // preserve supertype order
|
||||
val supertypesMap: MutableMap<CirType, CommonizedGroup<CirType>> = linkedMapOf() // preserve supertype order
|
||||
node.targetDeclarations.forEachIndexed { index, clazz ->
|
||||
for (supertype in clazz!!.supertypes) {
|
||||
supertypesMap.getOrPut(supertype.signature) { CommonizedGroup(node.targetDeclarations.size) }[index] = supertype
|
||||
supertypesMap.getOrPut(supertype) { CommonizedGroup(node.targetDeclarations.size) }[index] = supertype
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user