[IR] Support IrStarProjection in TypeArgumentMarker.replaceType

This commit is contained in:
marat.akhin
2023-07-13 10:01:16 +02:00
committed by Space Team
parent a2dda9e25b
commit 8eabaff29e
@@ -140,8 +140,13 @@ interface IrTypeSystemContext : TypeSystemContext, TypeSystemCommonSuperTypesCon
override fun TypeArgumentMarker.getVariance(): TypeVariance =
(this as? IrTypeProjection)?.variance?.convertVariance() ?: TypeVariance.OUT
override fun TypeArgumentMarker.replaceType(newType: KotlinTypeMarker): TypeArgumentMarker =
IrTypeProjectionImpl(newType as IrType, (this as IrTypeProjection).variance)
override fun TypeArgumentMarker.replaceType(newType: KotlinTypeMarker): TypeArgumentMarker {
require(this is IrTypeArgument)
return when (this) {
is IrStarProjection -> this
is IrTypeProjection -> IrTypeProjectionImpl(newType as IrType, this.variance)
}
}
override fun TypeArgumentMarker.getType() = (this as IrTypeProjection).type