[FIR] Introduce ConeDynamicType

This commit is contained in:
Nikolay Lunyak
2021-12-17 18:09:54 +03:00
committed by teamcity
parent e763197c3e
commit be9e97d044
13 changed files with 66 additions and 63 deletions
@@ -80,9 +80,9 @@ open class ConeFlexibleType(
final override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as ConeFlexibleType
// I suppose dynamic type (see below) and flexible type should use the same equals,
// because ft<Any?, Nothing> should never be created
if (other !is ConeFlexibleType) return false
if (lowerBound != other.lowerBound) return false
if (upperBound != other.upperBound) return false
@@ -97,6 +97,16 @@ open class ConeFlexibleType(
}
}
@RequiresOptIn(message = "Please use ConeDynamicType.create instead")
annotation class DynamicTypeConstructor
class ConeDynamicType @DynamicTypeConstructor constructor(
lowerBound: ConeSimpleKotlinType,
upperBound: ConeSimpleKotlinType
) : ConeFlexibleType(lowerBound, upperBound), DynamicTypeMarker {
companion object
}
fun ConeSimpleKotlinType.unwrapDefinitelyNotNull(): ConeSimpleKotlinType {
return when (this) {
is ConeDefinitelyNotNullType -> original
@@ -30,6 +30,11 @@ fun ConeKotlinType.render(): String {
is ConeLookupTagBasedType -> {
"${renderAttributes()}${lookupTag.name.asString()}"
}
is ConeDynamicType -> {
buildString {
append("dynamic")
}
}
is ConeFlexibleType -> {
buildString {
append("ft<")