[FIR] optimize direct allocation of empty ConeTypeProjection arrays
On the snapshot from KTIJ-26260 empty ConeTypeProjection arrays take about 10mb
This commit is contained in:
committed by
Space Team
parent
04d330edae
commit
bdfc68468f
+1
-1
@@ -572,7 +572,7 @@ internal class StubBasedFirMemberDeserializer(
|
|||||||
withPsiEntry("declaration", declaration)
|
withPsiEntry("declaration", declaration)
|
||||||
}
|
}
|
||||||
|
|
||||||
val enumType = ConeClassLikeTypeImpl(symbol.toLookupTag(), emptyArray(), false)
|
val enumType = ConeClassLikeTypeImpl(symbol.toLookupTag(), ConeTypeProjection.EMPTY_ARRAY, false)
|
||||||
val enumEntry = buildEnumEntry {
|
val enumEntry = buildEnumEntry {
|
||||||
source = KtRealPsiSourceElement(declaration)
|
source = KtRealPsiSourceElement(declaration)
|
||||||
this.moduleData = c.moduleData
|
this.moduleData = c.moduleData
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ sealed class ConeIntegerLiteralType(
|
|||||||
abstract val possibleTypes: Collection<ConeClassLikeType>
|
abstract val possibleTypes: Collection<ConeClassLikeType>
|
||||||
abstract val supertypes: List<ConeClassLikeType>
|
abstract val supertypes: List<ConeClassLikeType>
|
||||||
|
|
||||||
final override val typeArguments: Array<out ConeTypeProjection> = emptyArray()
|
final override val typeArguments: Array<out ConeTypeProjection> get() = EMPTY_ARRAY
|
||||||
final override val attributes: ConeAttributes get() = ConeAttributes.Empty
|
final override val attributes: ConeAttributes get() = ConeAttributes.Empty
|
||||||
|
|
||||||
abstract fun getApproximatedType(expectedType: ConeKotlinType? = null): ConeClassLikeType
|
abstract fun getApproximatedType(expectedType: ConeKotlinType? = null): ConeClassLikeType
|
||||||
|
|||||||
+2
-2
@@ -16,7 +16,7 @@ class ConeTypeVariableType(
|
|||||||
override val lookupTag: ConeTypeVariableTypeConstructor,
|
override val lookupTag: ConeTypeVariableTypeConstructor,
|
||||||
override val attributes: ConeAttributes = ConeAttributes.Empty,
|
override val attributes: ConeAttributes = ConeAttributes.Empty,
|
||||||
) : ConeLookupTagBasedType() {
|
) : ConeLookupTagBasedType() {
|
||||||
override val typeArguments: Array<out ConeTypeProjection> get() = emptyArray()
|
override val typeArguments: Array<out ConeTypeProjection> get() = EMPTY_ARRAY
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (this === other) return true
|
if (this === other) return true
|
||||||
if (other !is ConeTypeVariableType) return false
|
if (other !is ConeTypeVariableType) return false
|
||||||
@@ -65,7 +65,7 @@ sealed class ConeStubType(val constructor: ConeStubTypeConstructor, override val
|
|||||||
ConeSimpleKotlinType() {
|
ConeSimpleKotlinType() {
|
||||||
|
|
||||||
override val typeArguments: Array<out ConeTypeProjection>
|
override val typeArguments: Array<out ConeTypeProjection>
|
||||||
get() = emptyArray()
|
get() = EMPTY_ARRAY
|
||||||
|
|
||||||
override val attributes: ConeAttributes
|
override val attributes: ConeAttributes
|
||||||
get() = ConeAttributes.Empty
|
get() = ConeAttributes.Empty
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ data class ConeCapturedType(
|
|||||||
)
|
)
|
||||||
|
|
||||||
override val typeArguments: Array<out ConeTypeProjection>
|
override val typeArguments: Array<out ConeTypeProjection>
|
||||||
get() = emptyArray()
|
get() = EMPTY_ARRAY
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (this === other) return true
|
if (this === other) return true
|
||||||
@@ -220,7 +220,7 @@ class ConeIntersectionType(
|
|||||||
val alternativeType: ConeKotlinType? = null,
|
val alternativeType: ConeKotlinType? = null,
|
||||||
) : ConeSimpleKotlinType(), IntersectionTypeConstructorMarker {
|
) : ConeSimpleKotlinType(), IntersectionTypeConstructorMarker {
|
||||||
override val typeArguments: Array<out ConeTypeProjection>
|
override val typeArguments: Array<out ConeTypeProjection>
|
||||||
get() = emptyArray()
|
get() = EMPTY_ARRAY
|
||||||
|
|
||||||
override val nullability: ConeNullability
|
override val nullability: ConeNullability
|
||||||
get() = ConeNullability.NOT_NULL
|
get() = ConeNullability.NOT_NULL
|
||||||
|
|||||||
+2
-1
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProvider
|
|||||||
import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProviderInternals
|
import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProviderInternals
|
||||||
import org.jetbrains.kotlin.fir.scopes.FirKotlinScopeProvider
|
import org.jetbrains.kotlin.fir.scopes.FirKotlinScopeProvider
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||||
|
import org.jetbrains.kotlin.fir.types.ConeTypeProjection
|
||||||
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
||||||
import org.jetbrains.kotlin.fir.types.constructClassType
|
import org.jetbrains.kotlin.fir.types.constructClassType
|
||||||
import org.jetbrains.kotlin.fir.types.toLookupTag
|
import org.jetbrains.kotlin.fir.types.toLookupTag
|
||||||
@@ -125,7 +126,7 @@ class NativeForwardDeclarationsSymbolProvider(
|
|||||||
NativeStandardInteropNames.ExperimentalForeignApi
|
NativeStandardInteropNames.ExperimentalForeignApi
|
||||||
)
|
)
|
||||||
type = annotationClassId.toLookupTag()
|
type = annotationClassId.toLookupTag()
|
||||||
.constructClassType(typeArguments = emptyArray(), isNullable = false)
|
.constructClassType(typeArguments = ConeTypeProjection.EMPTY_ARRAY, isNullable = false)
|
||||||
}
|
}
|
||||||
argumentMapping = FirEmptyAnnotationArgumentMapping
|
argumentMapping = FirEmptyAnnotationArgumentMapping
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -187,7 +187,7 @@ abstract class AbstractAnnotationDeserializer(
|
|||||||
val classId = nameResolver.getClassId(proto.id)
|
val classId = nameResolver.getClassId(proto.id)
|
||||||
return buildAnnotation {
|
return buildAnnotation {
|
||||||
annotationTypeRef = buildResolvedTypeRef {
|
annotationTypeRef = buildResolvedTypeRef {
|
||||||
type = classId.toLookupTag().constructClassType(emptyArray(), isNullable = false)
|
type = classId.toLookupTag().constructClassType(ConeTypeProjection.EMPTY_ARRAY, isNullable = false)
|
||||||
}
|
}
|
||||||
session.lazyDeclarationResolver.disableLazyResolveContractChecksInside {
|
session.lazyDeclarationResolver.disableLazyResolveContractChecksInside {
|
||||||
this.argumentMapping = createArgumentMapping(proto, classId, nameResolver)
|
this.argumentMapping = createArgumentMapping(proto, classId, nameResolver)
|
||||||
|
|||||||
+3
-2
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirEnumEntrySymbol
|
|||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
||||||
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
||||||
|
import org.jetbrains.kotlin.fir.types.ConeTypeProjection
|
||||||
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
||||||
import org.jetbrains.kotlin.fir.types.coneTypeSafe
|
import org.jetbrains.kotlin.fir.types.coneTypeSafe
|
||||||
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
||||||
@@ -168,7 +169,7 @@ fun deserializeClassToSymbol(
|
|||||||
classProto.enumEntryList.mapNotNull { enumEntryProto ->
|
classProto.enumEntryList.mapNotNull { enumEntryProto ->
|
||||||
val enumEntryName = nameResolver.getName(enumEntryProto.name)
|
val enumEntryName = nameResolver.getName(enumEntryProto.name)
|
||||||
|
|
||||||
val enumType = ConeClassLikeTypeImpl(symbol.toLookupTag(), emptyArray(), false)
|
val enumType = ConeClassLikeTypeImpl(symbol.toLookupTag(), ConeTypeProjection.EMPTY_ARRAY, false)
|
||||||
val property = buildEnumEntry {
|
val property = buildEnumEntry {
|
||||||
this.moduleData = moduleData
|
this.moduleData = moduleData
|
||||||
this.origin = FirDeclarationOrigin.Library
|
this.origin = FirDeclarationOrigin.Library
|
||||||
@@ -265,7 +266,7 @@ fun FirRegularClassBuilder.addCloneForArrayIfNeeded(classId: ClassId, dispatchRe
|
|||||||
superTypeRefs += buildResolvedTypeRef {
|
superTypeRefs += buildResolvedTypeRef {
|
||||||
type = ConeClassLikeTypeImpl(
|
type = ConeClassLikeTypeImpl(
|
||||||
StandardClassIds.Cloneable.toLookupTag(),
|
StandardClassIds.Cloneable.toLookupTag(),
|
||||||
typeArguments = emptyArray(),
|
typeArguments = ConeTypeProjection.EMPTY_ARRAY,
|
||||||
isNullable = false
|
isNullable = false
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.fir.references.builder.buildErrorNamedReference
|
|||||||
import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference
|
import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference
|
||||||
import org.jetbrains.kotlin.fir.resolve.providers.getClassDeclaredPropertySymbols
|
import org.jetbrains.kotlin.fir.resolve.providers.getClassDeclaredPropertySymbols
|
||||||
import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
|
import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
|
||||||
|
import org.jetbrains.kotlin.fir.types.ConeTypeProjection
|
||||||
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
||||||
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
||||||
import org.jetbrains.kotlin.fir.types.toLookupTag
|
import org.jetbrains.kotlin.fir.types.toLookupTag
|
||||||
@@ -45,7 +46,7 @@ fun FirEnumEntryDeserializedAccessExpression.toQualifiedPropertyAccessExpression
|
|||||||
|
|
||||||
typeRef = buildResolvedTypeRef {
|
typeRef = buildResolvedTypeRef {
|
||||||
type = ConeClassLikeTypeImpl(
|
type = ConeClassLikeTypeImpl(
|
||||||
enumClassId.toLookupTag(), emptyArray(), isNullable = false
|
enumClassId.toLookupTag(), ConeTypeProjection.EMPTY_ARRAY, isNullable = false
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -49,7 +49,7 @@ import org.jetbrains.org.objectweb.asm.Type
|
|||||||
class FirJvmTypeMapper(val session: FirSession) : FirSessionComponent {
|
class FirJvmTypeMapper(val session: FirSession) : FirSessionComponent {
|
||||||
companion object {
|
companion object {
|
||||||
val NON_EXISTENT_ID = ClassId.topLevel(StandardNames.NON_EXISTENT_CLASS)
|
val NON_EXISTENT_ID = ClassId.topLevel(StandardNames.NON_EXISTENT_CLASS)
|
||||||
private val typeForNonExistentClass = NON_EXISTENT_ID.toLookupTag().constructClassType(emptyArray(), isNullable = false)
|
private val typeForNonExistentClass = NON_EXISTENT_ID.toLookupTag().constructClassType(ConeTypeProjection.EMPTY_ARRAY, isNullable = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun mapType(
|
fun mapType(
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ private fun JavaClassifierType.toConeKotlinTypeForFlexibleBound(
|
|||||||
else -> lowerBound?.typeArguments
|
else -> lowerBound?.typeArguments
|
||||||
}
|
}
|
||||||
|
|
||||||
lookupTag.constructClassType(mappedTypeArguments ?: emptyArray(), isNullable = lowerBound != null, attributes)
|
lookupTag.constructClassType(mappedTypeArguments ?: ConeTypeProjection.EMPTY_ARRAY, isNullable = lowerBound != null, attributes)
|
||||||
}
|
}
|
||||||
|
|
||||||
is JavaTypeParameter -> {
|
is JavaTypeParameter -> {
|
||||||
|
|||||||
+2
-1
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.fir.FirSession
|
|||||||
import org.jetbrains.kotlin.fir.declarations.builder.FirRegularClassBuilder
|
import org.jetbrains.kotlin.fir.declarations.builder.FirRegularClassBuilder
|
||||||
import org.jetbrains.kotlin.fir.deserialization.FirConstDeserializer
|
import org.jetbrains.kotlin.fir.deserialization.FirConstDeserializer
|
||||||
import org.jetbrains.kotlin.fir.deserialization.FirDeserializationExtension
|
import org.jetbrains.kotlin.fir.deserialization.FirDeserializationExtension
|
||||||
|
import org.jetbrains.kotlin.fir.types.ConeTypeProjection
|
||||||
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
||||||
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
||||||
import org.jetbrains.kotlin.fir.types.toLookupTag
|
import org.jetbrains.kotlin.fir.types.toLookupTag
|
||||||
@@ -43,7 +44,7 @@ class FirJvmDeserializationExtension(session: FirSession) : FirDeserializationEx
|
|||||||
superTypeRefs += buildResolvedTypeRef {
|
superTypeRefs += buildResolvedTypeRef {
|
||||||
type = ConeClassLikeTypeImpl(
|
type = ConeClassLikeTypeImpl(
|
||||||
JAVA_IO_SERIALIZABLE.toLookupTag(),
|
JAVA_IO_SERIALIZABLE.toLookupTag(),
|
||||||
typeArguments = emptyArray(),
|
typeArguments = ConeTypeProjection.EMPTY_ARRAY,
|
||||||
isNullable = false
|
isNullable = false
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ private fun mapTypeAliasArguments(
|
|||||||
useSiteSession: FirSession,
|
useSiteSession: FirSession,
|
||||||
): ConeKotlinType {
|
): ConeKotlinType {
|
||||||
if (typeAlias.typeParameters.isNotEmpty() && abbreviatedType.typeArguments.isEmpty()) {
|
if (typeAlias.typeParameters.isNotEmpty() && abbreviatedType.typeArguments.isEmpty()) {
|
||||||
return resultingType.lookupTag.constructClassType(emptyArray(), resultingType.isNullable)
|
return resultingType.lookupTag.constructClassType(ConeTypeProjection.EMPTY_ARRAY, resultingType.isNullable)
|
||||||
}
|
}
|
||||||
val typeAliasMap = typeAlias.typeParameters.map { it.symbol }.zip(abbreviatedType.typeArguments).toMap()
|
val typeAliasMap = typeAlias.typeParameters.map { it.symbol }.zip(abbreviatedType.typeArguments).toMap()
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -44,6 +44,7 @@ import org.jetbrains.kotlin.fir.scopes.FirScopeProvider
|
|||||||
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||||
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
||||||
|
import org.jetbrains.kotlin.fir.types.ConeTypeProjection
|
||||||
import org.jetbrains.kotlin.fir.types.FirTypeProjection
|
import org.jetbrains.kotlin.fir.types.FirTypeProjection
|
||||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||||
import org.jetbrains.kotlin.fir.types.FirUserTypeRef
|
import org.jetbrains.kotlin.fir.types.FirUserTypeRef
|
||||||
@@ -787,7 +788,7 @@ class LightTreeRawFirDeclarationBuilder(
|
|||||||
delegatedSelfTypeRef = buildResolvedTypeRef {
|
delegatedSelfTypeRef = buildResolvedTypeRef {
|
||||||
type = ConeClassLikeTypeImpl(
|
type = ConeClassLikeTypeImpl(
|
||||||
this@buildAnonymousObject.symbol.toLookupTag(),
|
this@buildAnonymousObject.symbol.toLookupTag(),
|
||||||
emptyArray(),
|
ConeTypeProjection.EMPTY_ARRAY,
|
||||||
isNullable = false
|
isNullable = false
|
||||||
)
|
)
|
||||||
}.also { registerSelfType(it) },
|
}.also { registerSelfType(it) },
|
||||||
|
|||||||
+1
-1
@@ -104,7 +104,7 @@ fun ConstantValueKind<*>.expectedConeType(session: FirSession): ConeKotlinType {
|
|||||||
fun constructLiteralType(classId: ClassId, isNullable: Boolean = false): ConeKotlinType {
|
fun constructLiteralType(classId: ClassId, isNullable: Boolean = false): ConeKotlinType {
|
||||||
val symbol = session.symbolProvider.getClassLikeSymbolByClassId(classId)
|
val symbol = session.symbolProvider.getClassLikeSymbolByClassId(classId)
|
||||||
?: return ConeErrorType(ConeSimpleDiagnostic("Missing stdlib class: $classId", DiagnosticKind.MissingStdlibClass))
|
?: return ConeErrorType(ConeSimpleDiagnostic("Missing stdlib class: $classId", DiagnosticKind.MissingStdlibClass))
|
||||||
return symbol.toLookupTag().constructClassType(emptyArray(), isNullable)
|
return symbol.toLookupTag().constructClassType(ConeTypeProjection.EMPTY_ARRAY, isNullable)
|
||||||
}
|
}
|
||||||
return when (this) {
|
return when (this) {
|
||||||
ConstantValueKind.Null -> session.builtinTypes.nullableNothingType.type
|
ConstantValueKind.Null -> session.builtinTypes.nullableNothingType.type
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.fir.expressions.builder.buildEmptyExpressionBlock
|
|||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirValueParameterSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirValueParameterSymbol
|
||||||
|
import org.jetbrains.kotlin.fir.types.ConeTypeProjection
|
||||||
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
||||||
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
||||||
import org.jetbrains.kotlin.fir.types.toLookupTag
|
import org.jetbrains.kotlin.fir.types.toLookupTag
|
||||||
@@ -50,7 +51,11 @@ fun FirRegularClassBuilder.generateValuesFunction(
|
|||||||
type = ConeClassLikeTypeImpl(
|
type = ConeClassLikeTypeImpl(
|
||||||
StandardClassIds.Array.toLookupTag(),
|
StandardClassIds.Array.toLookupTag(),
|
||||||
arrayOf(
|
arrayOf(
|
||||||
ConeClassLikeTypeImpl(this@generateValuesFunction.symbol.toLookupTag(), emptyArray(), isNullable = false)
|
ConeClassLikeTypeImpl(
|
||||||
|
this@generateValuesFunction.symbol.toLookupTag(),
|
||||||
|
ConeTypeProjection.EMPTY_ARRAY,
|
||||||
|
isNullable = false
|
||||||
|
)
|
||||||
),
|
),
|
||||||
isNullable = false
|
isNullable = false
|
||||||
)
|
)
|
||||||
@@ -145,7 +150,7 @@ fun FirRegularClassBuilder.generateEntriesGetter(
|
|||||||
type = ConeClassLikeTypeImpl(
|
type = ConeClassLikeTypeImpl(
|
||||||
StandardClassIds.EnumEntries.toLookupTag(),
|
StandardClassIds.EnumEntries.toLookupTag(),
|
||||||
arrayOf(
|
arrayOf(
|
||||||
ConeClassLikeTypeImpl(this@generateEntriesGetter.symbol.toLookupTag(), emptyArray(), isNullable = false)
|
ConeClassLikeTypeImpl(this@generateEntriesGetter.symbol.toLookupTag(), ConeTypeProjection.EMPTY_ARRAY, isNullable = false)
|
||||||
),
|
),
|
||||||
isNullable = false
|
isNullable = false
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.fir.declarations.FirClass
|
|||||||
import org.jetbrains.kotlin.fir.declarations.utils.classId
|
import org.jetbrains.kotlin.fir.declarations.utils.classId
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
||||||
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
||||||
|
import org.jetbrains.kotlin.fir.types.ConeTypeProjection
|
||||||
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
||||||
import org.jetbrains.kotlin.fir.types.toLookupTag
|
import org.jetbrains.kotlin.fir.types.toLookupTag
|
||||||
import org.jetbrains.kotlin.name.ClassId
|
import org.jetbrains.kotlin.name.ClassId
|
||||||
@@ -29,7 +30,7 @@ object StandardTypes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun ClassId.createType(isNullable: Boolean = false): ConeClassLikeType =
|
private fun ClassId.createType(isNullable: Boolean = false): ConeClassLikeType =
|
||||||
ConeClassLikeTypeImpl(this.toLookupTag(), emptyArray(), isNullable)
|
ConeClassLikeTypeImpl(this.toLookupTag(), ConeTypeProjection.EMPTY_ARRAY, isNullable)
|
||||||
|
|
||||||
fun ConeClassLikeType.isDouble(): Boolean = lookupTag.classId == StandardClassIds.Double
|
fun ConeClassLikeType.isDouble(): Boolean = lookupTag.classId == StandardClassIds.Double
|
||||||
fun ConeClassLikeType.isFloat(): Boolean = lookupTag.classId == StandardClassIds.Float
|
fun ConeClassLikeType.isFloat(): Boolean = lookupTag.classId == StandardClassIds.Float
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class ConeIntegerLiteralConstantTypeImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun createType(classId: ClassId): ConeClassLikeType {
|
private fun createType(classId: ClassId): ConeClassLikeType {
|
||||||
return ConeClassLikeTypeImpl(classId.toLookupTag(), emptyArray(), false)
|
return ConeClassLikeTypeImpl(classId.toLookupTag(), EMPTY_ARRAY, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val INT_RANGE = Int.MIN_VALUE.toLong()..Int.MAX_VALUE.toLong()
|
private val INT_RANGE = Int.MIN_VALUE.toLong()..Int.MAX_VALUE.toLong()
|
||||||
@@ -147,7 +147,7 @@ private object ConeIntegerLiteralTypeExtensions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun createClassLikeType(classId: ClassId): ConeClassLikeType {
|
fun createClassLikeType(classId: ClassId): ConeClassLikeType {
|
||||||
return ConeClassLikeTypeImpl(classId.toLookupTag(), emptyArray(), false)
|
return ConeClassLikeTypeImpl(classId.toLookupTag(), ConeTypeProjection.EMPTY_ARRAY, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ConeIntegerLiteralType.getApproximatedTypeImpl(expectedType: ConeKotlinType?): ConeClassLikeType {
|
fun ConeIntegerLiteralType.getApproximatedTypeImpl(expectedType: ConeKotlinType?): ConeClassLikeType {
|
||||||
|
|||||||
+1
-1
@@ -43,7 +43,7 @@ class FirNumberSignAttributeExtension(session: FirSession) : FirTypeAttributeExt
|
|||||||
annotationTypeRef = buildResolvedTypeRef {
|
annotationTypeRef = buildResolvedTypeRef {
|
||||||
type = ConeClassLikeTypeImpl(
|
type = ConeClassLikeTypeImpl(
|
||||||
classId.toLookupTag(),
|
classId.toLookupTag(),
|
||||||
emptyArray(),
|
ConeTypeProjection.EMPTY_ARRAY,
|
||||||
isNullable = false
|
isNullable = false
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -78,7 +78,7 @@ object FirParcelizeClassChecker : FirClassChecker() {
|
|||||||
val superType = superTypeRef.coneType
|
val superType = superTypeRef.coneType
|
||||||
val parcelableType = ConeClassLikeTypeImpl(
|
val parcelableType = ConeClassLikeTypeImpl(
|
||||||
PARCELABLE_ID.toLookupTag(),
|
PARCELABLE_ID.toLookupTag(),
|
||||||
emptyArray(),
|
ConeTypeProjection.EMPTY_ARRAY,
|
||||||
isNullable = false
|
isNullable = false
|
||||||
)
|
)
|
||||||
if (superType.isSubtypeOf(parcelableType, context.session)) {
|
if (superType.isSubtypeOf(parcelableType, context.session)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user