[Analysis API FE1.0] rename KtFe10Type.type -> KtFe10Type.fe10Type to disambiguatly ignore in testdata renderings
This commit is contained in:
+1
-2
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.analysis.api.descriptors.types.base.KtFe10Type
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.utils.KtFe10JvmTypeMapperContext
|
||||
import org.jetbrains.kotlin.analysis.api.lifetime.KtLifetimeToken
|
||||
import org.jetbrains.kotlin.analysis.api.types.KtType
|
||||
import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
|
||||
import org.jetbrains.kotlin.load.kotlin.TypeMappingMode
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
|
||||
@@ -25,7 +24,7 @@ internal class KtFe10JvmTypeMapper(
|
||||
private val typeMapper by lazy { KtFe10JvmTypeMapperContext(analysisContext.resolveSession) }
|
||||
|
||||
override fun mapTypeToJvmType(type: KtType, mode: TypeMappingMode): Type {
|
||||
val kotlinType = (type as KtFe10Type).type
|
||||
val kotlinType = (type as KtFe10Type).fe10Type
|
||||
return typeMapper.mapType(kotlinType, mode)
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -42,7 +42,7 @@ internal class KtFe10PsiTypeProvider(
|
||||
mode: KtTypeMappingMode,
|
||||
isAnnotationMethod: Boolean,
|
||||
): PsiType? {
|
||||
val kotlinType = (type as KtFe10Type).type
|
||||
val kotlinType = (type as KtFe10Type).fe10Type
|
||||
|
||||
with(typeMapper.typeContext) {
|
||||
if (kotlinType.contains { it.isError() }) {
|
||||
@@ -62,9 +62,9 @@ internal class KtFe10PsiTypeProvider(
|
||||
KtTypeMappingMode.SUPER_TYPE -> TypeMappingMode.SUPER_TYPE
|
||||
KtTypeMappingMode.SUPER_TYPE_KOTLIN_COLLECTIONS_AS_IS -> TypeMappingMode.SUPER_TYPE_KOTLIN_COLLECTIONS_AS_IS
|
||||
KtTypeMappingMode.RETURN_TYPE ->
|
||||
typeMapper.typeContext.getOptimalModeForReturnType(type.type, isAnnotationMethod)
|
||||
typeMapper.typeContext.getOptimalModeForReturnType(type.fe10Type, isAnnotationMethod)
|
||||
KtTypeMappingMode.VALUE_PARAMETER ->
|
||||
typeMapper.typeContext.getOptimalModeForValueParameter(type.type)
|
||||
typeMapper.typeContext.getOptimalModeForValueParameter(type.fe10Type)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -21,13 +21,13 @@ internal class KtFe10SubtypingComponent(
|
||||
override fun isEqualTo(first: KtType, second: KtType): Boolean {
|
||||
require(first is KtFe10Type)
|
||||
require(second is KtFe10Type)
|
||||
return analysisContext.resolveSession.kotlinTypeCheckerOfOwnerModule.equalTypes(first.type, second.type)
|
||||
return analysisContext.resolveSession.kotlinTypeCheckerOfOwnerModule.equalTypes(first.fe10Type, second.fe10Type)
|
||||
}
|
||||
|
||||
override fun isSubTypeOf(subType: KtType, superType: KtType): Boolean {
|
||||
require(subType is KtFe10Type)
|
||||
require(superType is KtFe10Type)
|
||||
val typeChecker = analysisContext.resolveSession.kotlinTypeCheckerOfOwnerModule
|
||||
return typeChecker.isSubtypeOf(subType.type, superType.type)
|
||||
return typeChecker.isSubtypeOf(subType.fe10Type, superType.fe10Type)
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -69,7 +69,7 @@ internal class KtFe10TypeCreator(
|
||||
val projections = builder.arguments.mapIndexed { index, arg ->
|
||||
when (arg) {
|
||||
is KtStarTypeProjection -> StarProjectionImpl(typeParameters[index])
|
||||
is KtTypeArgumentWithVariance -> TypeProjectionImpl(arg.variance, (arg.type as KtFe10Type).type)
|
||||
is KtTypeArgumentWithVariance -> TypeProjectionImpl(arg.variance, (arg.type as KtFe10Type).fe10Type)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -28,34 +28,34 @@ internal class KtFe10TypeInfoProvider(
|
||||
|
||||
override fun isFunctionalInterfaceType(type: KtType): Boolean {
|
||||
require(type is KtFe10Type)
|
||||
return JavaSingleAbstractMethodUtils.isSamType(type.type)
|
||||
return JavaSingleAbstractMethodUtils.isSamType(type.fe10Type)
|
||||
}
|
||||
|
||||
override fun getFunctionClassKind(type: KtType): FunctionClassKind? {
|
||||
require(type is KtFe10Type)
|
||||
return type.type.constructor.declarationDescriptor?.getFunctionalClassKind()
|
||||
return type.fe10Type.constructor.declarationDescriptor?.getFunctionalClassKind()
|
||||
}
|
||||
|
||||
override fun canBeNull(type: KtType): Boolean {
|
||||
require(type is KtFe10Type)
|
||||
return TypeUtils.isNullableType(type.type)
|
||||
return TypeUtils.isNullableType(type.fe10Type)
|
||||
}
|
||||
|
||||
override fun isDenotable(type: KtType): Boolean {
|
||||
require(type is KtFe10Type)
|
||||
val kotlinType = type.type
|
||||
val kotlinType = type.fe10Type
|
||||
return kotlinType.isDenotable()
|
||||
}
|
||||
|
||||
override fun isArrayOrPrimitiveArray(type: KtType): Boolean {
|
||||
require(type is KtFe10Type)
|
||||
return KotlinBuiltIns.isArrayOrPrimitiveArray(type.type)
|
||||
return KotlinBuiltIns.isArrayOrPrimitiveArray(type.fe10Type)
|
||||
}
|
||||
|
||||
override fun isNestedArray(type: KtType): Boolean {
|
||||
if (!isArrayOrPrimitiveArray(type)) return false
|
||||
require(type is KtFe10Type)
|
||||
val unwrappedType = type.type
|
||||
val unwrappedType = type.fe10Type
|
||||
val elementType = unwrappedType.constructor.builtIns.getArrayElementType(unwrappedType)
|
||||
return KotlinBuiltIns.isArrayOrPrimitiveArray(elementType)
|
||||
}
|
||||
|
||||
+7
-11
@@ -12,15 +12,11 @@ import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.Fe10AnalysisFacade.AnalysisMode
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.components.base.Fe10KtAnalysisSessionComponent
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.base.KtFe10Symbol
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.KtFe10DescSyntheticFieldSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.*
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.KtFe10DescSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.classId
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.getSymbolDescriptor
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.isInterfaceLike
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.toKtType
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.psiBased.KtFe10PsiDefaultPropertyGetterSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.psiBased.base.KtFe10PsiSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.psiBased.base.getResolutionScope
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.types.base.KtFe10Type
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.utils.PublicApproximatorConfiguration
|
||||
@@ -69,12 +65,12 @@ internal class KtFe10TypeProvider(
|
||||
|
||||
override fun approximateToSuperPublicDenotableType(type: KtType, approximateLocalTypes: Boolean): KtType? {
|
||||
require(type is KtFe10Type)
|
||||
return typeApproximator.approximateToSuperType(type.type, PublicApproximatorConfiguration(approximateLocalTypes))?.toKtType(analysisContext)
|
||||
return typeApproximator.approximateToSuperType(type.fe10Type, PublicApproximatorConfiguration(approximateLocalTypes))?.toKtType(analysisContext)
|
||||
}
|
||||
|
||||
override fun approximateToSubPublicDenotableType(type: KtType, approximateLocalTypes: Boolean): KtType? {
|
||||
require(type is KtFe10Type)
|
||||
return typeApproximator.approximateToSubType(type.type, PublicApproximatorConfiguration(approximateLocalTypes))?.toKtType(analysisContext)
|
||||
return typeApproximator.approximateToSubType(type.fe10Type, PublicApproximatorConfiguration(approximateLocalTypes))?.toKtType(analysisContext)
|
||||
}
|
||||
|
||||
override fun buildSelfClassType(symbol: KtNamedClassOrObjectSymbol): KtType {
|
||||
@@ -85,7 +81,7 @@ internal class KtFe10TypeProvider(
|
||||
}
|
||||
|
||||
override fun commonSuperType(types: Collection<KtType>): KtType {
|
||||
val kotlinTypes = types.map { (it as KtFe10Type).type }
|
||||
val kotlinTypes = types.map { (it as KtFe10Type).fe10Type }
|
||||
return CommonSupertypes.commonSupertype(kotlinTypes).toKtType(analysisContext)
|
||||
}
|
||||
|
||||
@@ -104,11 +100,11 @@ internal class KtFe10TypeProvider(
|
||||
|
||||
override fun withNullability(type: KtType, newNullability: KtTypeNullability): KtType {
|
||||
require(type is KtFe10Type)
|
||||
return type.type.makeNullableAsSpecified(newNullability == KtTypeNullability.NULLABLE).toKtType(analysisContext)
|
||||
return type.fe10Type.makeNullableAsSpecified(newNullability == KtTypeNullability.NULLABLE).toKtType(analysisContext)
|
||||
}
|
||||
|
||||
override fun haveCommonSubtype(a: KtType, b: KtType): Boolean {
|
||||
return areTypesCompatible((a as KtFe10Type).type, (b as KtFe10Type).type)
|
||||
return areTypesCompatible((a as KtFe10Type).fe10Type, (b as KtFe10Type).fe10Type)
|
||||
}
|
||||
|
||||
override fun getImplicitReceiverTypesAtPosition(position: KtElement): List<KtType> {
|
||||
@@ -121,12 +117,12 @@ internal class KtFe10TypeProvider(
|
||||
|
||||
override fun getDirectSuperTypes(type: KtType, shouldApproximate: Boolean): List<KtType> {
|
||||
require(type is KtFe10Type)
|
||||
return TypeUtils.getImmediateSupertypes(type.type).map { it.toKtType(analysisContext) }
|
||||
return TypeUtils.getImmediateSupertypes(type.fe10Type).map { it.toKtType(analysisContext) }
|
||||
}
|
||||
|
||||
override fun getAllSuperTypes(type: KtType, shouldApproximate: Boolean): List<KtType> {
|
||||
require(type is KtFe10Type)
|
||||
return TypeUtils.getAllSupertypes(type.type).map { it.toKtType(analysisContext) }
|
||||
return TypeUtils.getAllSupertypes(type.fe10Type).map { it.toKtType(analysisContext) }
|
||||
}
|
||||
|
||||
override fun getDispatchReceiverType(symbol: KtCallableSymbol): KtType? {
|
||||
|
||||
+5
-5
@@ -9,22 +9,22 @@ import org.jetbrains.kotlin.analysis.api.KtTypeProjection
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.Fe10AnalysisContext
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.ktNullability
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.toKtTypeProjection
|
||||
import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.types.base.KtFe10Type
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.types.base.asStringForDebugging
|
||||
import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
|
||||
import org.jetbrains.kotlin.analysis.api.types.KtCapturedType
|
||||
import org.jetbrains.kotlin.analysis.api.types.KtTypeNullability
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.CapturedType
|
||||
|
||||
internal class KtFe10CapturedType(
|
||||
override val type: CapturedType,
|
||||
override val fe10Type: CapturedType,
|
||||
override val analysisContext: Fe10AnalysisContext
|
||||
) : KtCapturedType(), KtFe10Type {
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { type.asStringForDebugging() }
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { fe10Type.asStringForDebugging() }
|
||||
|
||||
override val nullability: KtTypeNullability
|
||||
get() = withValidityAssertion { type.ktNullability }
|
||||
get() = withValidityAssertion { fe10Type.ktNullability }
|
||||
|
||||
override val projection: KtTypeProjection
|
||||
get() = withValidityAssertion { type.typeProjection.toKtTypeProjection(analysisContext) }
|
||||
get() = withValidityAssertion { fe10Type.typeProjection.toKtTypeProjection(analysisContext) }
|
||||
}
|
||||
+7
-7
@@ -18,30 +18,30 @@ import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.types.error.ErrorType
|
||||
|
||||
internal class KtFe10ClassErrorType(
|
||||
override val type: ErrorType,
|
||||
override val fe10Type: ErrorType,
|
||||
override val analysisContext: Fe10AnalysisContext
|
||||
) : KtClassErrorType(), KtFe10Type {
|
||||
init {
|
||||
check(type.kind.isUnresolved) {
|
||||
"Expected unresolved ErrorType but ${type.kind} found for $type"
|
||||
check(fe10Type.kind.isUnresolved) {
|
||||
"Expected unresolved ErrorType but ${fe10Type.kind} found for $fe10Type"
|
||||
}
|
||||
}
|
||||
|
||||
override val qualifiers: List<KtClassTypeQualifier.KtUnresolvedClassTypeQualifier>
|
||||
get() = withValidityAssertion {
|
||||
type.formatParams.first().split('.').map {
|
||||
fe10Type.formatParams.first().split('.').map {
|
||||
KtClassTypeQualifier.KtUnresolvedClassTypeQualifier(Name.guessByFirstCharacter(it), emptyList(), token)
|
||||
}
|
||||
}
|
||||
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { type.asStringForDebugging() }
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { fe10Type.asStringForDebugging() }
|
||||
|
||||
override val errorMessage: String
|
||||
get() = withValidityAssertion { type.debugMessage }
|
||||
get() = withValidityAssertion { fe10Type.debugMessage }
|
||||
|
||||
override val candidateClassSymbols: Collection<KtClassLikeSymbol>
|
||||
get() = withValidityAssertion { emptyList() }
|
||||
|
||||
override val nullability: KtTypeNullability
|
||||
get() = withValidityAssertion { type.ktNullability }
|
||||
get() = withValidityAssertion { fe10Type.ktNullability }
|
||||
}
|
||||
+3
-4
@@ -6,7 +6,6 @@
|
||||
package org.jetbrains.kotlin.analysis.api.descriptors.types
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.Fe10AnalysisContext
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.toKtType
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.types.base.KtFe10Type
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.types.base.asStringForDebugging
|
||||
@@ -16,11 +15,11 @@ import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
|
||||
import org.jetbrains.kotlin.types.DefinitelyNotNullType
|
||||
|
||||
internal class KtFe10DefinitelyNotNullType(
|
||||
override val type: DefinitelyNotNullType,
|
||||
override val fe10Type: DefinitelyNotNullType,
|
||||
override val analysisContext: Fe10AnalysisContext
|
||||
) : KtDefinitelyNotNullType(), KtFe10Type {
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { type.asStringForDebugging() }
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { fe10Type.asStringForDebugging() }
|
||||
|
||||
override val original: KtType
|
||||
get() = withValidityAssertion { type.original.toKtType(analysisContext) }
|
||||
get() = withValidityAssertion { fe10Type.original.toKtType(analysisContext) }
|
||||
}
|
||||
+3
-3
@@ -15,11 +15,11 @@ import org.jetbrains.kotlin.analysis.api.types.KtTypeNullability
|
||||
import org.jetbrains.kotlin.types.DynamicType
|
||||
|
||||
internal class KtFe10DynamicType(
|
||||
override val type: DynamicType,
|
||||
override val fe10Type: DynamicType,
|
||||
override val analysisContext: Fe10AnalysisContext
|
||||
) : KtDynamicType(), KtFe10Type {
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { type.asStringForDebugging() }
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { fe10Type.asStringForDebugging() }
|
||||
|
||||
override val nullability: KtTypeNullability
|
||||
get() = withValidityAssertion { type.ktNullability }
|
||||
get() = withValidityAssertion { fe10Type.ktNullability }
|
||||
}
|
||||
|
||||
+5
-6
@@ -6,7 +6,6 @@
|
||||
package org.jetbrains.kotlin.analysis.api.descriptors.types
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.Fe10AnalysisContext
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.ktNullability
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.toKtType
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.types.base.KtFe10Type
|
||||
@@ -18,17 +17,17 @@ import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
|
||||
import org.jetbrains.kotlin.types.FlexibleType
|
||||
|
||||
internal class KtFe10FlexibleType(
|
||||
override val type: FlexibleType,
|
||||
override val fe10Type: FlexibleType,
|
||||
override val analysisContext: Fe10AnalysisContext
|
||||
) : KtFlexibleType(), KtFe10Type {
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { type.asStringForDebugging() }
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { fe10Type.asStringForDebugging() }
|
||||
|
||||
override val lowerBound: KtType
|
||||
get() = withValidityAssertion { type.lowerBound.toKtType(analysisContext) }
|
||||
get() = withValidityAssertion { fe10Type.lowerBound.toKtType(analysisContext) }
|
||||
|
||||
override val upperBound: KtType
|
||||
get() = withValidityAssertion { type.upperBound.toKtType(analysisContext) }
|
||||
get() = withValidityAssertion { fe10Type.upperBound.toKtType(analysisContext) }
|
||||
|
||||
override val nullability: KtTypeNullability
|
||||
get() = withValidityAssertion { type.ktNullability }
|
||||
get() = withValidityAssertion { fe10Type.ktNullability }
|
||||
}
|
||||
+13
-13
@@ -30,18 +30,18 @@ import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.types.SimpleType
|
||||
|
||||
internal class KtFe10FunctionalType(
|
||||
override val type: SimpleType,
|
||||
override val fe10Type: SimpleType,
|
||||
private val descriptor: FunctionClassDescriptor,
|
||||
override val analysisContext: Fe10AnalysisContext
|
||||
) : KtFunctionalType(), KtFe10Type {
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { type.asStringForDebugging() }
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { fe10Type.asStringForDebugging() }
|
||||
|
||||
override val nullability: KtTypeNullability
|
||||
get() = withValidityAssertion { type.ktNullability }
|
||||
get() = withValidityAssertion { fe10Type.ktNullability }
|
||||
|
||||
override val qualifiers: List<KtClassTypeQualifier.KtResolvedClassTypeQualifier>
|
||||
get() = withValidityAssertion {
|
||||
KtFe10JvmTypeMapperContext.getNestedType(type).allInnerTypes.map { innerType ->
|
||||
KtFe10JvmTypeMapperContext.getNestedType(fe10Type).allInnerTypes.map { innerType ->
|
||||
KtClassTypeQualifier.KtResolvedClassTypeQualifier(
|
||||
innerType.classDescriptor.toKtClassSymbol(analysisContext),
|
||||
innerType.arguments.map { it.toKtTypeProjection(analysisContext) },
|
||||
@@ -57,12 +57,12 @@ internal class KtFe10FunctionalType(
|
||||
get() = withValidityAssertion { descriptor.arity }
|
||||
|
||||
override val hasContextReceivers: Boolean
|
||||
get() = withValidityAssertion { type.contextFunctionTypeParamsCount() > 0 }
|
||||
get() = withValidityAssertion { fe10Type.contextFunctionTypeParamsCount() > 0 }
|
||||
|
||||
@OptIn(KtAnalysisApiInternals::class)
|
||||
override val contextReceivers: List<KtContextReceiver>
|
||||
get() = withValidityAssertion {
|
||||
type.getContextReceiverTypesFromFunctionType().map { receiverType ->
|
||||
fe10Type.getContextReceiverTypesFromFunctionType().map { receiverType ->
|
||||
// Context receivers in function types may not have labels, hence the `null` label.
|
||||
KtContextReceiverImpl(
|
||||
receiverType.toKtType(analysisContext),
|
||||
@@ -75,28 +75,28 @@ internal class KtFe10FunctionalType(
|
||||
override val hasReceiver: Boolean
|
||||
get() = withValidityAssertion {
|
||||
if (descriptor.functionKind.isReflectType) false
|
||||
else type.getReceiverTypeFromFunctionType() != null
|
||||
else fe10Type.getReceiverTypeFromFunctionType() != null
|
||||
}
|
||||
|
||||
override val receiverType: KtType?
|
||||
get() = withValidityAssertion {
|
||||
if (descriptor.functionKind.isReflectType) null
|
||||
else type.getReceiverTypeFromFunctionType()?.toKtType(analysisContext)
|
||||
else fe10Type.getReceiverTypeFromFunctionType()?.toKtType(analysisContext)
|
||||
}
|
||||
|
||||
override val parameterTypes: List<KtType>
|
||||
get() = withValidityAssertion {
|
||||
when {
|
||||
descriptor.functionKind.isReflectType -> type.arguments.dropLast(1)
|
||||
else -> type.getValueParameterTypesFromFunctionType()
|
||||
descriptor.functionKind.isReflectType -> fe10Type.arguments.dropLast(1)
|
||||
else -> fe10Type.getValueParameterTypesFromFunctionType()
|
||||
}.map { it.type.toKtType(analysisContext) }
|
||||
}
|
||||
|
||||
override val returnType: KtType
|
||||
get() = withValidityAssertion {
|
||||
when {
|
||||
descriptor.functionKind.isReflectType -> type.arguments.last().type
|
||||
else -> type.getReturnTypeFromFunctionType()
|
||||
descriptor.functionKind.isReflectType -> fe10Type.arguments.last().type
|
||||
else -> fe10Type.getReturnTypeFromFunctionType()
|
||||
}.toKtType(analysisContext)
|
||||
}
|
||||
|
||||
@@ -112,5 +112,5 @@ internal class KtFe10FunctionalType(
|
||||
get() = withValidityAssertion { KtFe10DescNamedClassOrObjectSymbol(descriptor, analysisContext) }
|
||||
|
||||
override val ownTypeArguments: List<KtTypeProjection>
|
||||
get() = withValidityAssertion { type.arguments.map { it.toKtTypeProjection(analysisContext) } }
|
||||
get() = withValidityAssertion { fe10Type.arguments.map { it.toKtTypeProjection(analysisContext) } }
|
||||
}
|
||||
+4
-5
@@ -6,7 +6,6 @@
|
||||
package org.jetbrains.kotlin.analysis.api.descriptors.types
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.Fe10AnalysisContext
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.ktNullability
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.toKtType
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.types.base.KtFe10Type
|
||||
@@ -21,15 +20,15 @@ import org.jetbrains.kotlin.types.SimpleType
|
||||
import org.jetbrains.kotlin.types.typeUtil.makeNullable
|
||||
|
||||
internal class KtFe10IntersectionType(
|
||||
override val type: SimpleType,
|
||||
override val fe10Type: SimpleType,
|
||||
private val supertypes: Collection<KotlinType>,
|
||||
override val analysisContext: Fe10AnalysisContext
|
||||
) : KtIntersectionType(), KtFe10Type {
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { type.asStringForDebugging() }
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { fe10Type.asStringForDebugging() }
|
||||
|
||||
override val conjuncts: List<KtType> by cached {
|
||||
val result = ArrayList<KtType>(supertypes.size)
|
||||
val isNullable = type.isMarkedNullable
|
||||
val isNullable = fe10Type.isMarkedNullable
|
||||
for (supertype in supertypes) {
|
||||
val mappedSupertype = if (isNullable) supertype.makeNullable() else supertype
|
||||
result += mappedSupertype.toKtType(analysisContext)
|
||||
@@ -38,5 +37,5 @@ internal class KtFe10IntersectionType(
|
||||
}
|
||||
|
||||
override val nullability: KtTypeNullability
|
||||
get() = withValidityAssertion { type.ktNullability }
|
||||
get() = withValidityAssertion { fe10Type.ktNullability }
|
||||
}
|
||||
+4
-4
@@ -17,14 +17,14 @@ import org.jetbrains.kotlin.analysis.api.types.KtTypeNullability
|
||||
import org.jetbrains.kotlin.types.checker.NewCapturedType
|
||||
|
||||
internal class KtFe10NewCapturedType(
|
||||
override val type: NewCapturedType,
|
||||
override val fe10Type: NewCapturedType,
|
||||
override val analysisContext: Fe10AnalysisContext
|
||||
) : KtCapturedType(), KtFe10Type {
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { type.asStringForDebugging() }
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { fe10Type.asStringForDebugging() }
|
||||
|
||||
override val nullability: KtTypeNullability
|
||||
get() = withValidityAssertion { type.ktNullability }
|
||||
get() = withValidityAssertion { fe10Type.ktNullability }
|
||||
|
||||
override val projection: KtTypeProjection
|
||||
get() = withValidityAssertion { type.constructor.projection.toKtTypeProjection(analysisContext) }
|
||||
get() = withValidityAssertion { fe10Type.constructor.projection.toKtTypeProjection(analysisContext) }
|
||||
}
|
||||
+8
-8
@@ -16,28 +16,28 @@ import org.jetbrains.kotlin.types.error.ErrorType
|
||||
import org.jetbrains.kotlin.types.error.ErrorTypeKind
|
||||
|
||||
internal class KtFe10TypeErrorType(
|
||||
override val type: ErrorType,
|
||||
override val fe10Type: ErrorType,
|
||||
override val analysisContext: Fe10AnalysisContext
|
||||
) : KtTypeErrorType(), KtFe10Type {
|
||||
init {
|
||||
check(!type.kind.isUnresolved) {
|
||||
"Expected unresolved ErrorType but ${type.kind} found for $type"
|
||||
check(!fe10Type.kind.isUnresolved) {
|
||||
"Expected unresolved ErrorType but ${fe10Type.kind} found for $fe10Type"
|
||||
}
|
||||
}
|
||||
|
||||
override fun tryRenderAsNonErrorType(): String? = withValidityAssertion {
|
||||
when (type.kind) {
|
||||
ErrorTypeKind.UNINFERRED_TYPE_VARIABLE -> type.formatParams.first()
|
||||
when (fe10Type.kind) {
|
||||
ErrorTypeKind.UNINFERRED_TYPE_VARIABLE -> fe10Type.formatParams.first()
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { type.asStringForDebugging() }
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { fe10Type.asStringForDebugging() }
|
||||
|
||||
override val errorMessage: String
|
||||
get() = withValidityAssertion { type.debugMessage }
|
||||
get() = withValidityAssertion { fe10Type.debugMessage }
|
||||
|
||||
override val nullability: KtTypeNullability
|
||||
get() = withValidityAssertion { type.ktNullability }
|
||||
get() = withValidityAssertion { fe10Type.ktNullability }
|
||||
}
|
||||
+3
-4
@@ -6,7 +6,6 @@
|
||||
package org.jetbrains.kotlin.analysis.api.descriptors.types
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.Fe10AnalysisContext
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.KtFe10DescTypeParameterSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.ktNullability
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.types.base.KtFe10Type
|
||||
@@ -20,17 +19,17 @@ import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.types.SimpleType
|
||||
|
||||
internal class KtFe10TypeParameterType(
|
||||
override val type: SimpleType,
|
||||
override val fe10Type: SimpleType,
|
||||
private val parameter: TypeParameterDescriptor,
|
||||
override val analysisContext: Fe10AnalysisContext
|
||||
) : KtTypeParameterType(), KtFe10Type {
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { type.asStringForDebugging() }
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { fe10Type.asStringForDebugging() }
|
||||
|
||||
override val name: Name
|
||||
get() = withValidityAssertion { parameter.name }
|
||||
|
||||
override val nullability: KtTypeNullability
|
||||
get() = withValidityAssertion { type.ktNullability }
|
||||
get() = withValidityAssertion { fe10Type.ktNullability }
|
||||
|
||||
override val symbol: KtTypeParameterSymbol
|
||||
get() = withValidityAssertion { KtFe10DescTypeParameterSymbol(parameter, analysisContext) }
|
||||
|
||||
+5
-5
@@ -25,15 +25,15 @@ import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.types.SimpleType
|
||||
|
||||
internal class KtFe10UsualClassType(
|
||||
override val type: SimpleType,
|
||||
override val fe10Type: SimpleType,
|
||||
private val descriptor: ClassDescriptor,
|
||||
override val analysisContext: Fe10AnalysisContext
|
||||
) : KtUsualClassType(), KtFe10Type {
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { type.asStringForDebugging() }
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { fe10Type.asStringForDebugging() }
|
||||
|
||||
override val qualifiers: List<KtClassTypeQualifier.KtResolvedClassTypeQualifier>
|
||||
get() = withValidityAssertion {
|
||||
val nestedType = KtFe10JvmTypeMapperContext.getNestedType(type)
|
||||
val nestedType = KtFe10JvmTypeMapperContext.getNestedType(fe10Type)
|
||||
val nonInnerQualifiers =
|
||||
generateSequence(nestedType.root.classifierDescriptor.containingDeclaration as? ClassDescriptor) { it.containingDeclaration as? ClassDescriptor }
|
||||
|
||||
@@ -64,9 +64,9 @@ internal class KtFe10UsualClassType(
|
||||
get() = withValidityAssertion { KtFe10DescNamedClassOrObjectSymbol(descriptor, analysisContext) }
|
||||
|
||||
override val ownTypeArguments: List<KtTypeProjection>
|
||||
get() = withValidityAssertion { type.arguments.map { it.toKtTypeProjection(analysisContext) } }
|
||||
get() = withValidityAssertion { fe10Type.arguments.map { it.toKtTypeProjection(analysisContext) } }
|
||||
|
||||
override val nullability: KtTypeNullability
|
||||
get() = withValidityAssertion { type.ktNullability }
|
||||
get() = withValidityAssertion { fe10Type.ktNullability }
|
||||
|
||||
}
|
||||
+3
-3
@@ -18,15 +18,15 @@ import org.jetbrains.kotlin.name.StandardClassIds
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.UnwrappedType
|
||||
|
||||
interface KtFe10Type : KtLifetimeOwner, KtAnnotated {
|
||||
val type: UnwrappedType
|
||||
internal interface KtFe10Type : KtLifetimeOwner, KtAnnotated {
|
||||
val fe10Type: UnwrappedType
|
||||
|
||||
val analysisContext: Fe10AnalysisContext
|
||||
|
||||
override val annotationsList: KtAnnotationsList
|
||||
get() = withValidityAssertion {
|
||||
KtFe10AnnotationsList.create(
|
||||
type.annotations,
|
||||
fe10Type.annotations,
|
||||
token,
|
||||
ignoreAnnotations = setOf(
|
||||
StandardClassIds.Annotations.ExtensionFunctionType,
|
||||
|
||||
Reference in New Issue
Block a user