Change lookup tags from interfaces to abstract classes
This commit is contained in:
committed by
Mikhail Glukhikh
parent
a10deb5f69
commit
146a53f18c
+1
-1
@@ -247,7 +247,7 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) {
|
||||
null,
|
||||
ConeClassTypeImpl(
|
||||
klass.symbol.toLookupTag(),
|
||||
typeParameters.map { ConeTypeParameterTypeImpl(it.symbol, false) }.toTypedArray(),
|
||||
typeParameters.map { ConeTypeParameterTypeImpl(it.symbol.toLookupTag(), false) }.toTypedArray(),
|
||||
false
|
||||
)
|
||||
)
|
||||
|
||||
+2
-2
@@ -57,7 +57,7 @@ class FirTypeDeserializer(
|
||||
|
||||
|
||||
private fun typeParameterSymbol(typeParameterId: Int): ConeTypeParameterLookupTag? =
|
||||
typeParameterDescriptors[typeParameterId] ?: parent?.typeParameterSymbol(typeParameterId)
|
||||
typeParameterDescriptors[typeParameterId]?.toLookupTag() ?: parent?.typeParameterSymbol(typeParameterId)
|
||||
|
||||
|
||||
private fun ProtoBuf.TypeParameter.Variance.convertVariance(): Variance {
|
||||
@@ -150,7 +150,7 @@ class FirTypeDeserializer(
|
||||
val name = nameResolver.getString(proto.typeParameterName)
|
||||
|
||||
// TODO: Optimize
|
||||
ownTypeParameters.find { it.name.asString() == name }
|
||||
ownTypeParameters.find { it.name.asString() == name }?.toLookupTag()
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ fun ConeAbbreviatedType.directExpansionType(useSiteSession: FirSession): ConeCla
|
||||
fun ConeClassifierLookupTag.toSymbol(useSiteSession: FirSession): ConeClassifierSymbol? =
|
||||
when (this) {
|
||||
is ConeClassLikeLookupTag -> toSymbol(useSiteSession)
|
||||
is ConeTypeParameterSymbol -> this
|
||||
is ConeTypeParameterLookupTag -> this.symbol
|
||||
else -> error("sealed ${this::class}")
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ fun ConeClassifierLookupTag.constructType(typeArguments: Array<ConeKotlinTypePro
|
||||
fun ConeClassifierSymbol.constructType(typeArguments: Array<ConeKotlinTypeProjection>, isNullable: Boolean): ConeLookupTagBasedType {
|
||||
return when (this) {
|
||||
is ConeTypeParameterSymbol -> {
|
||||
ConeTypeParameterTypeImpl(this, isNullable)
|
||||
ConeTypeParameterTypeImpl(this.toLookupTag(), isNullable)
|
||||
}
|
||||
is ConeClassSymbol -> {
|
||||
ConeClassTypeImpl(this.toLookupTag(), typeArguments, isNullable)
|
||||
|
||||
@@ -34,7 +34,7 @@ fun ConeInferenceContext.hasNullableSuperType(type: ConeKotlinType): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
class ConeTypeVariableTypeConstructor(val debugName: String) : ConeSymbol, ConeClassifierLookupTag, TypeVariableTypeConstructorMarker {
|
||||
class ConeTypeVariableTypeConstructor(val debugName: String) : ConeSymbol, ConeClassifierLookupTag(), TypeVariableTypeConstructorMarker {
|
||||
override val name: Name get() = Name.identifier(debugName)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -134,6 +134,6 @@ class ConeSubstitutorByMap(val substitution: Map<ConeTypeParameterSymbol, ConeKo
|
||||
|
||||
override fun substituteType(type: ConeKotlinType): ConeKotlinType? {
|
||||
if (type !is ConeTypeParameterType) return null
|
||||
return makeNullableIfNeed(type.isMarkedNullable, substitution[type.lookupTag])
|
||||
return makeNullableIfNeed(type.isMarkedNullable, substitution[type.lookupTag.symbol])
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ class FirCallCompleterTransformer(
|
||||
|
||||
val subCandidate = calleeReference.candidate
|
||||
val declaration = subCandidate.symbol.firUnsafe<FirCallableMemberDeclaration>()
|
||||
val newTypeParameters = declaration.typeParameters.map { ConeTypeParameterTypeImpl(it.symbol, false) }
|
||||
val newTypeParameters = declaration.typeParameters.map { ConeTypeParameterTypeImpl(it.symbol.toLookupTag(), false) }
|
||||
.map { subCandidate.substitutor.substituteOrSelf(it) }
|
||||
.map { finalSubstitutor.substituteOrSelf(it) }
|
||||
.mapIndexed { index, type ->
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ abstract class AbstractFirOverrideScope(val session: FirSession) : FirScope {
|
||||
if (member.typeParameters.size != self.typeParameters.size) return false
|
||||
|
||||
val types = self.typeParameters.map {
|
||||
ConeTypeParameterTypeImpl(it.symbol, false)
|
||||
ConeTypeParameterTypeImpl(it.symbol.toLookupTag(), false)
|
||||
}
|
||||
val substitution = ConeSubstitutorByMap(member.typeParameters.map { it.symbol }.zip(types).toMap())
|
||||
if (!member.typeParameters.zip(self.typeParameters).all { (a, b) ->
|
||||
|
||||
Reference in New Issue
Block a user