[AA LC] Expand aliases of type arguments during conversion to KtType

^KT-55781
This commit is contained in:
Dmitriy Novozhilov
2022-10-03 17:01:25 +03:00
committed by Space Team
parent 36ae901b19
commit ed867af01d
10 changed files with 80 additions and 2 deletions
@@ -61,8 +61,26 @@ val ConeTypeProjection.type: ConeKotlinType?
get() = when (this) {
ConeStarProjection -> null
is ConeKotlinTypeProjection -> type
is ConeKotlinType -> this
}
val ConeTypeProjection.isStarProjection: Boolean
get() = this == ConeStarProjection
fun ConeTypeProjection.replaceType(newType: ConeKotlinType?): ConeTypeProjection {
return when (this) {
is ConeStarProjection -> this
is ConeKotlinTypeProjection -> {
requireNotNull(newType) { "Type for non star projection should be not null" }
replaceType(newType)
}
}
}
fun ConeKotlinTypeProjection.replaceType(newType: ConeKotlinType): ConeKotlinTypeProjection {
return when (this) {
is ConeKotlinType -> newType
is ConeKotlinTypeProjectionIn -> ConeKotlinTypeProjectionIn(newType)
is ConeKotlinTypeProjectionOut -> ConeKotlinTypeProjectionOut(newType)
is ConeKotlinTypeConflictingProjection -> ConeKotlinTypeConflictingProjection(newType)
}
}