[FIR] Reorganize ConeKotlinTypeProjection hierarchy

This commit is contained in:
simon.ogorodnik
2020-02-26 16:38:15 +03:00
parent 7c4f59dfcb
commit f405b3f827
22 changed files with 72 additions and 78 deletions
@@ -232,7 +232,7 @@ private fun ConeClassLikeType.mapToCanonicalNoExpansionString(session: FirSessio
if (lookupTag.classId == StandardClassIds.Array) {
return when (val typeProjection = typeArguments[0]) {
is ConeStarProjection -> CommonClassNames.JAVA_LANG_OBJECT
is ConeTypedProjection -> {
is ConeKotlinTypeProjection -> {
if (typeProjection.kind == ProjectionKind.IN)
CommonClassNames.JAVA_LANG_VOID
else
@@ -259,10 +259,10 @@ private fun ConeClassLikeType.mapToCanonicalNoExpansionString(session: FirSessio
}
private fun ConeKotlinTypeProjection.mapToCanonicalString(session: FirSession): String {
private fun ConeTypeProjection.mapToCanonicalString(session: FirSession): String {
return when (this) {
is ConeStarProjection -> "?"
is ConeTypedProjection -> {
is ConeKotlinTypeProjection -> {
val wildcard = when (kind) {
ProjectionKind.STAR -> error("Should be handled in the case above")
ProjectionKind.IN -> "? super "
@@ -63,7 +63,7 @@ internal val JavaClass.classKind: ClassKind
}
internal fun ClassId.toConeKotlinType(
typeArguments: Array<ConeKotlinTypeProjection>,
typeArguments: Array<ConeTypeProjection>,
isNullable: Boolean
): ConeLookupTagBasedType {
val lookupTag = ConeClassLikeLookupTagImpl(this)
@@ -152,8 +152,8 @@ internal fun JavaType?.toConeKotlinTypeWithoutEnhancement(
}
private fun ClassId.toConeFlexibleType(
typeArguments: Array<ConeKotlinTypeProjection>,
typeArgumentsForUpper: Array<ConeKotlinTypeProjection> = typeArguments
typeArguments: Array<ConeTypeProjection>,
typeArgumentsForUpper: Array<ConeTypeProjection> = typeArguments
) = ConeFlexibleType(
toConeKotlinType(typeArguments, isNullable = false),
toConeKotlinType(typeArgumentsForUpper, isNullable = true)
@@ -367,7 +367,7 @@ private fun JavaType?.toConeProjectionWithoutEnhancement(
session: FirSession,
javaTypeParameterStack: JavaTypeParameterStack,
boundTypeParameter: FirTypeParameter?
): ConeKotlinTypeProjection {
): ConeTypeProjection {
return when (this) {
null -> ConeStarProjection
is JavaWildcardType -> {