[FIR] Introduce & use FirTypeRef.coneType

This commit is contained in:
Mikhail Glukhikh
2020-06-30 11:23:50 +03:00
parent 0392fe75fc
commit d846a22e33
55 changed files with 162 additions and 193 deletions
@@ -221,7 +221,7 @@ private fun FirTypeParameter.getErasedUpperBound(
): ConeKotlinType {
if (this === potentiallyRecursiveTypeParameter) return defaultValue()
val firstUpperBound = this.bounds.first().coneTypeUnsafe<ConeKotlinType>()
val firstUpperBound = this.bounds.first().coneType
return getErasedVersionOfFirstUpperBound(firstUpperBound, mutableSetOf(this, potentiallyRecursiveTypeParameter), defaultValue)
}
@@ -256,7 +256,7 @@ private fun getErasedVersionOfFirstUpperBound(
val current = firstUpperBound.lookupTag.typeParameterSymbol.fir
if (alreadyVisitedParameters.add(current)) {
val nextUpperBound = current.bounds.first().coneTypeUnsafe<ConeKotlinType>()
val nextUpperBound = current.bounds.first().coneType
getErasedVersionOfFirstUpperBound(nextUpperBound, alreadyVisitedParameters, defaultValue)
} else {
defaultValue()
@@ -119,7 +119,7 @@ private fun coneFlexibleOrSimpleType(
// TODO: we need enhancement for type parameter bounds for this code to work properly
// At this moment, this condition is always true
if (lookupTag.typeParameterSymbol.fir.bounds.any {
val type = (it as FirResolvedTypeRef).type
val type = it.coneType
type is ConeTypeParameterType || type.isNullable
}
) {