[AA] integrate KtReceiverParameterSymbol to KtCallableSymbol

^KT-54417
This commit is contained in:
Dmitrii Gridin
2022-10-18 11:08:23 +02:00
committed by Space Team
parent b333a214ca
commit 2741052db3
125 changed files with 1169 additions and 1091 deletions
@@ -51,7 +51,7 @@ internal object PsiDeclarationAndKtSymbolEqualityChecker {
if (psi.parameterList.parametersCount != valueParameterCount) return false
if (symbol.isExtension) {
val psiParameter = psi.parameterList.parameters[0]
if (symbol.receiverType?.let { isTheSameTypes(psi, psiParameter.type, it, isVararg = false) } != true) return false
if (symbol.receiver?.type?.let { isTheSameTypes(psi, psiParameter.type, it, isVararg = false) } != true) return false
}
val offset = if (symbol.isExtension) 1 else 0
symbol.valueParameters.forEachIndexed { index, valueParameterSymbol ->
@@ -13,9 +13,9 @@ import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.annotations.annotations
import org.jetbrains.kotlin.analysis.api.lifetime.isValid
import org.jetbrains.kotlin.analysis.api.symbols.KtCallableSymbol
import org.jetbrains.kotlin.analysis.api.symbols.KtReceiverParameterSymbol
import org.jetbrains.kotlin.analysis.api.symbols.KtSymbol
import org.jetbrains.kotlin.analysis.api.symbols.markers.KtNamedSymbol
import org.jetbrains.kotlin.analysis.api.types.KtType
import org.jetbrains.kotlin.asJava.classes.lazyPub
import org.jetbrains.kotlin.codegen.AsmUtil
import org.jetbrains.kotlin.light.classes.symbol.annotations.SymbolLightAnnotationForAnnotationCall
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.psi.KtParameter
context(KtAnalysisSession)
internal class SymbolLightParameterForReceiver private constructor(
private val receiverType: KtType,
private val receiver: KtReceiverParameterSymbol,
private val context: KtSymbol,
methodName: String,
method: SymbolLightMethodBase
@@ -43,13 +43,13 @@ internal class SymbolLightParameterForReceiver private constructor(
if (callableSymbol !is KtNamedSymbol) return null
if (!callableSymbol.isExtension) return null
val extensionTypeAndAnnotations = callableSymbol.receiverType ?: return null
val extensionTypeAndAnnotations = callableSymbol.receiver ?: return null
return SymbolLightParameterForReceiver(
receiverType = extensionTypeAndAnnotations,
receiver = extensionTypeAndAnnotations,
context = callableSymbol,
methodName = callableSymbol.name.asString(),
method = method
method = method,
)
}
}
@@ -69,8 +69,8 @@ internal class SymbolLightParameterForReceiver private constructor(
private val _annotations: List<PsiAnnotation> by lazyPub {
buildList {
receiverType.nullabilityType.computeNullabilityAnnotation(this@SymbolLightParameterForReceiver)?.let { add(it) }
receiverType.annotations.mapTo(this) {
receiver.type.nullabilityType.computeNullabilityAnnotation(this@SymbolLightParameterForReceiver)?.let { add(it) }
receiver.annotations.mapTo(this) {
SymbolLightAnnotationForAnnotationCall(it, this@SymbolLightParameterForReceiver)
}
}
@@ -82,7 +82,7 @@ internal class SymbolLightParameterForReceiver private constructor(
}
private val _type: PsiType by lazyPub {
receiverType.asPsiType(this@SymbolLightParameterForReceiver) ?: nonExistentType()
receiver.type.asPsiType(this@SymbolLightParameterForReceiver) ?: nonExistentType()
}
override fun getType(): PsiType = _type
@@ -90,7 +90,7 @@ internal class SymbolLightParameterForReceiver private constructor(
override fun equals(other: Any?): Boolean =
this === other ||
(other is SymbolLightParameterForReceiver &&
receiverType == other.receiverType)
receiver == other.receiver)
override fun hashCode(): Int = kotlinOrigin.hashCode()