FIR IDE: do not make KtTypeArgumentWithVariance abstract

As it does not require specific FIR implementation
This commit is contained in:
Ilya Kirillov
2021-06-11 13:37:18 +02:00
committed by TeamCityServer
parent 6a9c49dd9d
commit 148c90dd1e
4 changed files with 14 additions and 16 deletions
@@ -105,7 +105,7 @@ fun KtTypeAndAnnotations.toKotlinType(context: FE10BindingContext): UnwrappedTyp
fun KtTypeArgument.toTypeProjection(context: FE10BindingContext): TypeProjection =
when (this) {
KtStarProjectionTypeArgument -> StarProjectionForAbsentTypeParameter(context.builtIns)
is KtStarProjectionTypeArgument -> StarProjectionForAbsentTypeParameter(context.builtIns)
is KtTypeArgumentWithVariance -> TypeProjectionImpl(variance, type.toKotlinType(context))
}
@@ -5,14 +5,17 @@
package org.jetbrains.kotlin.idea.frontend.api
import org.jetbrains.kotlin.idea.frontend.api.tokens.ValidityToken
import org.jetbrains.kotlin.idea.frontend.api.types.KtType
import org.jetbrains.kotlin.types.Variance
sealed class KtTypeArgument
sealed class KtTypeArgument : ValidityTokenOwner
object KtStarProjectionTypeArgument : KtTypeArgument()
class KtStarProjectionTypeArgument(override val token: ValidityToken) : KtTypeArgument()
class KtTypeArgumentWithVariance(
val type: KtType,
val variance: Variance,
override val token: ValidityToken,
) : KtTypeArgument()
abstract class KtTypeArgumentWithVariance : KtTypeArgument() {
abstract val type: KtType
abstract val variance: Variance
}
@@ -336,10 +336,11 @@ internal class KtSymbolByFirBuilder private constructor(
}
fun buildTypeArgument(coneType: ConeTypeProjection): KtTypeArgument = when (coneType) {
is ConeStarProjection -> KtStarProjectionTypeArgument
is ConeKotlinTypeProjection -> KtFirTypeArgumentWithVariance(
is ConeStarProjection -> KtStarProjectionTypeArgument(token)
is ConeKotlinTypeProjection -> KtTypeArgumentWithVariance(
buildKtType(coneType.type),
coneType.kind.toVariance()
coneType.kind.toVariance(),
token,
)
}
@@ -18,7 +18,6 @@ import org.jetbrains.kotlin.idea.frontend.api.tokens.ValidityToken
import org.jetbrains.kotlin.idea.frontend.api.types.*
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.Variance
internal interface KtFirType : ValidityTokenOwner {
val coneType: ConeKotlinType
@@ -171,8 +170,3 @@ internal class KtFirIntersectionType(
override fun asStringForDebugging(): String = withValidityAssertion { coneType.render() }
}
internal class KtFirTypeArgumentWithVariance(
override val type: KtType,
override val variance: Variance
) : KtTypeArgumentWithVariance()