[FIR2IR] Approximate non-denotable types when converting ConeType to IrType

This commit is contained in:
Dmitriy Novozhilov
2021-02-27 15:19:23 +03:00
committed by TeamCityServer
parent c271f953d7
commit da0fd7cc15
31 changed files with 147 additions and 325 deletions
@@ -236,7 +236,8 @@ class ConeRawType(lowerBound: ConeKotlinType, upperBound: ConeKotlinType) : Cone
* only via ConeTypeIntersector
*/
class ConeIntersectionType(
val intersectedTypes: Collection<ConeKotlinType>
val intersectedTypes: Collection<ConeKotlinType>,
val alternativeType: ConeKotlinType? = null,
) : ConeSimpleKotlinType(), IntersectionTypeConstructorMarker {
override val typeArguments: Array<out ConeTypeProjection>
get() = emptyArray()
@@ -266,7 +267,10 @@ class ConeIntersectionType(
if (hashCode != 0) return hashCode
return intersectedTypes.hashCode().also { hashCode = it }
}
}
fun ConeIntersectionType.withAlternative(alternativeType: ConeKotlinType): ConeIntersectionType {
return ConeIntersectionType(intersectedTypes, alternativeType)
}
fun ConeIntersectionType.mapTypes(func: (ConeKotlinType) -> ConeKotlinType): ConeIntersectionType {