Minor. Reformat JavaTypeConversion.kt

This commit is contained in:
Denis.Zharkov
2022-10-13 10:56:47 +02:00
committed by Space Team
parent 5cc31114cd
commit e5d2f4712a
@@ -120,6 +120,7 @@ private fun JavaType?.toConeTypeProjection(
// It should not affect semantics, since it would be still a valid type anyway // It should not affect semantics, since it would be still a valid type anyway
avoidComprehensiveCheck = true, avoidComprehensiveCheck = true,
) ?: lowerBound ) ?: lowerBound
else -> lowerBound else -> lowerBound
} }
@@ -130,6 +131,7 @@ private fun JavaType?.toConeTypeProjection(
val (classId, arguments) = when (val componentType = componentType) { val (classId, arguments) = when (val componentType = componentType) {
is JavaPrimitiveType -> is JavaPrimitiveType ->
StandardClassIds.byName(componentType.type!!.arrayTypeName.identifier) to arrayOf() StandardClassIds.byName(componentType.type!!.arrayTypeName.identifier) to arrayOf()
else -> else ->
StandardClassIds.Array to arrayOf(componentType.toConeKotlinType(session, javaTypeParameterStack, mode)) StandardClassIds.Array to arrayOf(componentType.toConeKotlinType(session, javaTypeParameterStack, mode))
} }
@@ -199,6 +201,7 @@ private fun JavaClassifierType.toConeKotlinTypeForFlexibleBound(
?: Array(classifier.typeParameters.size) { ConeStarProjection } ?: Array(classifier.typeParameters.size) { ConeStarProjection }
} }
} }
lookupTag != lowerBound?.lookupTag && typeArguments.isNotEmpty() -> { lookupTag != lowerBound?.lookupTag && typeArguments.isNotEmpty() -> {
val typeParameterSymbols = val typeParameterSymbols =
lookupTag.takeIf { mode != FirJavaTypeConversionMode.TYPE_PARAMETER_BOUND } lookupTag.takeIf { mode != FirJavaTypeConversionMode.TYPE_PARAMETER_BOUND }
@@ -211,19 +214,23 @@ private fun JavaClassifierType.toConeKotlinTypeForFlexibleBound(
argument.toConeTypeProjection(session, javaTypeParameterStack, variance, newMode) argument.toConeTypeProjection(session, javaTypeParameterStack, variance, newMode)
} }
} }
else -> lowerBound?.typeArguments else -> lowerBound?.typeArguments
} }
lookupTag.constructClassType(mappedTypeArguments ?: emptyArray(), isNullable = lowerBound != null, attributes) lookupTag.constructClassType(mappedTypeArguments ?: emptyArray(), isNullable = lowerBound != null, attributes)
} }
is JavaTypeParameter -> { is JavaTypeParameter -> {
val symbol = javaTypeParameterStack[classifier] val symbol = javaTypeParameterStack[classifier]
ConeTypeParameterTypeImpl(symbol.toLookupTag(), isNullable = lowerBound != null, attributes) ConeTypeParameterTypeImpl(symbol.toLookupTag(), isNullable = lowerBound != null, attributes)
} }
null -> { null -> {
val classId = ClassId.topLevel(FqName(this.classifierQualifiedName)) val classId = ClassId.topLevel(FqName(this.classifierQualifiedName))
classId.constructClassLikeType(emptyArray(), isNullable = lowerBound != null, attributes) classId.constructClassLikeType(emptyArray(), isNullable = lowerBound != null, attributes)
} }
else -> ConeErrorType(ConeSimpleDiagnostic("Unexpected classifier: $classifier", DiagnosticKind.Java)) else -> ConeErrorType(ConeSimpleDiagnostic("Unexpected classifier: $classifier", DiagnosticKind.Java))
} }
} }