[FIR] Add ConeKotlinTypeConflictingProjection, return it from substituteArgument instead of ConeStarProjection in appropriate cases, remove plus operator from ProjectionKind
This commit is contained in:
committed by
teamcityserver
parent
b85846c0c0
commit
ca970f0a8b
@@ -15,16 +15,6 @@ import org.jetbrains.kotlin.utils.addToStdlib.foldMap
|
||||
|
||||
enum class ProjectionKind {
|
||||
STAR, IN, OUT, INVARIANT;
|
||||
|
||||
operator fun plus(other: ProjectionKind): ProjectionKind {
|
||||
return when {
|
||||
this == other -> this
|
||||
this == STAR || other == STAR -> STAR
|
||||
this == INVARIANT -> other
|
||||
other == INVARIANT -> this
|
||||
else -> STAR
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sealed class ConeTypeProjection : TypeArgumentMarker {
|
||||
@@ -54,6 +44,11 @@ data class ConeKotlinTypeProjectionOut(override val type: ConeKotlinType) : Cone
|
||||
get() = ProjectionKind.OUT
|
||||
}
|
||||
|
||||
data class ConeKotlinTypeConflictingProjection(override val type: ConeKotlinType) : ConeKotlinTypeProjection() {
|
||||
override val kind: ProjectionKind
|
||||
get() = ProjectionKind.INVARIANT
|
||||
}
|
||||
|
||||
val ConeTypeProjection.type: ConeKotlinType?
|
||||
get() = when (this) {
|
||||
ConeStarProjection -> null
|
||||
|
||||
@@ -59,6 +59,7 @@ private fun ConeKotlinType.renderAttributes(): String {
|
||||
fun ConeTypeProjection.render(): String {
|
||||
return when (this) {
|
||||
ConeStarProjection -> "*"
|
||||
is ConeKotlinTypeConflictingProjection -> "CONFLICTING-PROJECTION ${type.render()}"
|
||||
is ConeKotlinTypeProjectionIn -> "in ${type.render()}"
|
||||
is ConeKotlinTypeProjectionOut -> "out ${type.render()}"
|
||||
is ConeKotlinType -> render()
|
||||
|
||||
Reference in New Issue
Block a user