[FIR] Rename createArrayOf to createArrayType

This commit is contained in:
Dmitriy Novozhilov
2020-09-11 10:49:13 +03:00
parent 3b941a8f43
commit 324aaaddad
5 changed files with 6 additions and 7 deletions
@@ -139,7 +139,7 @@ internal class KClassValue(value: Value) : ConstantValue<KClassValue.Value>(valu
val klass = session.firSymbolProvider.getClassLikeSymbolByFqName(classId)?.fir as? FirRegularClass ?: return null
var type: ConeKotlinType = klass.defaultType().replaceArgumentsWithStarProjections()
repeat(arrayDimensions) {
type = type.createArrayOf()
type = type.createArrayType()
}
return type
}
@@ -35,7 +35,6 @@ import org.jetbrains.kotlin.fir.types.builder.buildStarProjection
import org.jetbrains.kotlin.fir.types.builder.buildTypeProjectionWithVariance
import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl
import org.jetbrains.kotlin.fir.visitors.*
import org.jetbrains.kotlin.resolve.calls.NewCommonSuperTypeCalculator
import org.jetbrains.kotlin.types.AbstractTypeApproximator
import org.jetbrains.kotlin.types.TypeApproximatorConfiguration
import org.jetbrains.kotlin.types.Variance
@@ -546,7 +545,7 @@ class FirCallCompletionResultsWriterTransformer(
arrayOfCall.transformChildren(this, expectedArrayElementType?.toExpectedType())
val arrayElementType = session.inferenceComponents.ctx.commonSuperTypeOrNull(arrayOfCall.arguments.map { it.typeRef.coneType })
?: session.builtinTypes.nullableAnyType.type
arrayOfCall.resultType = arrayOfCall.typeRef.resolvedTypeFromPrototype(arrayElementType.createArrayOf())
arrayOfCall.resultType = arrayOfCall.typeRef.resolvedTypeFromPrototype(arrayElementType.createArrayType())
return arrayOfCall.compose()
}
@@ -214,7 +214,7 @@ class FirSyntheticCallGenerator(
val (typeParameter, returnType) = generateSyntheticSelectTypeParameter()
val argumentType = buildResolvedTypeRef { type = returnType.type.createArrayOf() }
val argumentType = buildResolvedTypeRef { type = returnType.type.createArrayType() }
val typeArgument = buildTypeProjectionWithVariance {
typeRef = returnType
variance = Variance.INVARIANT
@@ -101,7 +101,7 @@ internal fun FirTypedDeclaration.transformTypeToArrayType() {
transformReturnTypeRef(
StoreType,
returnTypeRef.withReplacedConeType(
ConeKotlinTypeProjectionOut(returnType).createArrayOf(),
ConeKotlinTypeProjectionOut(returnType).createArrayType(),
FirFakeSourceElementKind.ArrayTypeFromVarargParameter
)
)
@@ -8,10 +8,10 @@ package org.jetbrains.kotlin.fir.types
import org.jetbrains.kotlin.fir.symbols.StandardClassIds
fun ConeKotlinType.createOutArrayType(nullable: Boolean = false): ConeKotlinType {
return ConeKotlinTypeProjectionOut(this).createArrayOf(nullable)
return ConeKotlinTypeProjectionOut(this).createArrayType(nullable)
}
fun ConeTypeProjection.createArrayOf(nullable: Boolean = false): ConeKotlinType {
fun ConeTypeProjection.createArrayType(nullable: Boolean = false): ConeKotlinType {
if (this is ConeKotlinTypeProjection) {
val type = type.lowerBoundIfFlexible()
if (type is ConeClassLikeType && type.nullability != ConeNullability.NULLABLE) {