[Commonizer] Drop CirTypeParameter interface for plain data class
This commit is contained in:
committed by
Space
parent
4a4516731a
commit
fdee49ee59
@@ -7,33 +7,10 @@ package org.jetbrains.kotlin.commonizer.cir
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.types.Variance
|
import org.jetbrains.kotlin.types.Variance
|
||||||
|
|
||||||
interface CirTypeParameter : CirHasAnnotations, CirHasName {
|
data class CirTypeParameter(
|
||||||
val isReified: Boolean
|
|
||||||
val variance: Variance
|
|
||||||
val upperBounds: List<CirType>
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
|
||||||
inline fun create(
|
|
||||||
annotations: List<CirAnnotation>,
|
|
||||||
name: CirName,
|
|
||||||
isReified: Boolean,
|
|
||||||
variance: Variance,
|
|
||||||
upperBounds: List<CirType>
|
|
||||||
): CirTypeParameter = CirTypeParameterImpl(
|
|
||||||
annotations = annotations,
|
|
||||||
name = name,
|
|
||||||
isReified = isReified,
|
|
||||||
variance = variance,
|
|
||||||
upperBounds = upperBounds
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data class CirTypeParameterImpl(
|
|
||||||
override val annotations: List<CirAnnotation>,
|
override val annotations: List<CirAnnotation>,
|
||||||
override val name: CirName,
|
override val name: CirName,
|
||||||
override val isReified: Boolean,
|
val isReified: Boolean,
|
||||||
override val variance: Variance,
|
val variance: Variance,
|
||||||
override val upperBounds: List<CirType>
|
val upperBounds: List<CirType>
|
||||||
) : CirTypeParameter
|
) : CirHasAnnotations, CirHasName
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ class TypeParameterCommonizer(classifiers: CirKnownClassifiers) : AbstractStanda
|
|||||||
private lateinit var variance: Variance
|
private lateinit var variance: Variance
|
||||||
private val upperBounds = TypeParameterUpperBoundsCommonizer(classifiers)
|
private val upperBounds = TypeParameterUpperBoundsCommonizer(classifiers)
|
||||||
|
|
||||||
override fun commonizationResult() = CirTypeParameter.create(
|
override fun commonizationResult() = CirTypeParameter(
|
||||||
annotations = emptyList(),
|
annotations = emptyList(),
|
||||||
name = name,
|
name = name,
|
||||||
isReified = isReified,
|
isReified = isReified,
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ object CirDeserializers {
|
|||||||
|
|
||||||
private val ALWAYS_HAS_ANNOTATIONS: Flags = flagsOf(Flag.Common.HAS_ANNOTATIONS)
|
private val ALWAYS_HAS_ANNOTATIONS: Flags = flagsOf(Flag.Common.HAS_ANNOTATIONS)
|
||||||
|
|
||||||
private fun typeParameter(source: KmTypeParameter, typeResolver: CirTypeResolver): CirTypeParameter = CirTypeParameter.create(
|
private fun typeParameter(source: KmTypeParameter, typeResolver: CirTypeResolver): CirTypeParameter = CirTypeParameter(
|
||||||
annotations = annotations(ALWAYS_HAS_ANNOTATIONS, typeResolver, source::annotations),
|
annotations = annotations(ALWAYS_HAS_ANNOTATIONS, typeResolver, source::annotations),
|
||||||
name = CirName.create(source.name),
|
name = CirName.create(source.name),
|
||||||
isReified = Flag.TypeParameter.IS_REIFIED(source.flags),
|
isReified = Flag.TypeParameter.IS_REIFIED(source.flags),
|
||||||
|
|||||||
+1
-1
@@ -86,7 +86,7 @@ class TypeParameterCommonizerTest : AbstractCommonizerTest<CirTypeParameter, Cir
|
|||||||
isReified: Boolean = false,
|
isReified: Boolean = false,
|
||||||
variance: Variance = Variance.INVARIANT,
|
variance: Variance = Variance.INVARIANT,
|
||||||
upperBounds: List<String> = listOf("kotlin/Any")
|
upperBounds: List<String> = listOf("kotlin/Any")
|
||||||
) = CirTypeParameter.create(
|
) = CirTypeParameter(
|
||||||
annotations = emptyList(),
|
annotations = emptyList(),
|
||||||
name = CirName.create(name),
|
name = CirName.create(name),
|
||||||
isReified = isReified,
|
isReified = isReified,
|
||||||
|
|||||||
Reference in New Issue
Block a user