[FIR] Partially support raw types

This commit is contained in:
Simon Ogorodnik
2019-11-12 23:56:36 +03:00
parent 119a3f1306
commit 6e8f8f9a65
4 changed files with 129 additions and 19 deletions
@@ -119,7 +119,7 @@ abstract class ConeAbbreviatedType : ConeClassLikeType() {
abstract val abbreviationLookupTag: ConeClassLikeLookupTag
}
data class ConeFlexibleType(val lowerBound: ConeKotlinType, val upperBound: ConeKotlinType) : ConeKotlinType(),
open class ConeFlexibleType(val lowerBound: ConeKotlinType, val upperBound: ConeKotlinType) : ConeKotlinType(),
FlexibleTypeMarker {
init {
@@ -133,6 +133,25 @@ data class ConeFlexibleType(val lowerBound: ConeKotlinType, val upperBound: Cone
override val nullability: ConeNullability
get() = lowerBound.nullability.takeIf { it == upperBound.nullability } ?: ConeNullability.UNKNOWN
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as ConeFlexibleType
if (lowerBound != other.lowerBound) return false
if (upperBound != other.upperBound) return false
return true
}
override fun hashCode(): Int {
var result = lowerBound.hashCode()
result = 31 * result + upperBound.hashCode()
return result
}
}
fun ConeKotlinType.upperBoundIfFlexible() = (this as? ConeFlexibleType)?.upperBound ?: this
@@ -182,6 +201,8 @@ class ConeDefinitelyNotNullType private constructor(val original: ConeKotlinType
}
}
class ConeRawType(lowerBound: ConeKotlinType, upperBound: ConeKotlinType) : ConeFlexibleType(lowerBound, upperBound), RawTypeMarker
/*
* Contract of the intersection type: it is flat. It means that
* intersection type can not contains another intersection types