FIR: minor cone types refactoring

This commit is contained in:
Mikhail Glukhikh
2018-03-22 10:46:30 +03:00
parent 4d48c40832
commit dfa8c32c5d
3 changed files with 10 additions and 12 deletions
@@ -15,7 +15,6 @@ enum class ProjectionKind {
STAR, IN, OUT, INVARIANT
}
object StarProjection : ConeKotlinTypeProjection(ProjectionKind.STAR)
abstract class ConeKotlinTypeProjectionIn : ConeKotlinTypeProjection(ProjectionKind.IN) {
@@ -26,9 +25,17 @@ abstract class ConeKotlinTypeProjectionOut : ConeKotlinTypeProjection(Projection
abstract val type: ConeKotlinType
}
abstract class ConeKotlinType : ConeKotlinTypeProjection(ProjectionKind.INVARIANT)
// We assume type IS an invariant type projection to prevent additional wrapper here
// (more exactly, invariant type projection contains type)
sealed class ConeKotlinType : ConeKotlinTypeProjection(ProjectionKind.INVARIANT)
abstract class ConeSymbolBasedType : ConeKotlinType() {
class ConeKotlinErrorType(val reason: String) : ConeKotlinType() {
override fun toString(): String {
return "<ERROR TYPE: $reason>"
}
}
sealed class ConeSymbolBasedType : ConeKotlinType() {
abstract val symbol: ConeSymbol
}
@@ -18,13 +18,6 @@ class ConeKotlinTypeProjectionInImpl(override val type: ConeKotlinType) : ConeKo
class ConeKotlinTypeProjectionOutImpl(override val type: ConeKotlinType) : ConeKotlinTypeProjectionOut()
class ConeKotlinErrorType(val reason: String) : ConeKotlinType() {
override fun toString(): String {
return "<ERROR TYPE: $reason>"
}
}
class ConeAbbreviatedTypeImpl(
override val abbreviationSymbol: ConeClassLikeSymbol,
override val typeArguments: List<ConeKotlinTypeProjection>,
@@ -13,7 +13,6 @@ import org.jetbrains.kotlin.fir.symbols.ConeClassLikeSymbol
import org.jetbrains.kotlin.fir.symbols.ConeSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol
import org.jetbrains.kotlin.fir.types.*
import org.jetbrains.kotlin.fir.types.impl.ConeKotlinErrorType
import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid
import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.utils.Printer
@@ -453,7 +452,6 @@ class FirRenderer(builder: StringBuilder) : FirVisitorVoid() {
is ConeTypeParameterType -> {
symbol.asString()
}
else -> "Unsupported: $this"
}
}