[AA] KtCallableSymbol: introduce receiverType extension
^KT-54417
This commit is contained in:
committed by
Space Team
parent
1ebfbc0ee9
commit
d0cc88ffe0
+5
-4
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.analysis.api.signatures.KtVariableLikeSignature
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtCallableSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtFunctionLikeSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtVariableLikeSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.receiverType
|
||||
import org.jetbrains.kotlin.analysis.api.types.KtSubstitutor
|
||||
import org.jetbrains.kotlin.analysis.utils.errors.unexpectedElementError
|
||||
|
||||
@@ -47,7 +48,7 @@ abstract class AbstractKtSignatureSubstitutorImpl : KtSignatureSubstitutor() {
|
||||
return KtFunctionLikeSignature(
|
||||
symbol,
|
||||
substitutor.substitute(symbol.returnType),
|
||||
symbol.receiverParameter?.type?.let { substitutor.substitute(it) },
|
||||
symbol.receiverType?.let { substitutor.substitute(it) },
|
||||
symbol.valueParameters.map { substitute(it, substitutor) }
|
||||
)
|
||||
}
|
||||
@@ -57,7 +58,7 @@ abstract class AbstractKtSignatureSubstitutorImpl : KtSignatureSubstitutor() {
|
||||
return KtVariableLikeSignature(
|
||||
symbol,
|
||||
substitutor.substitute(symbol.returnType),
|
||||
symbol.receiverParameter?.type?.let { substitutor.substitute(it) },
|
||||
symbol.receiverType?.let { substitutor.substitute(it) },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -70,10 +71,10 @@ abstract class AbstractKtSignatureSubstitutorImpl : KtSignatureSubstitutor() {
|
||||
}
|
||||
|
||||
override fun <S : KtFunctionLikeSymbol> asSignature(symbol: S): KtFunctionLikeSignature<S> {
|
||||
return KtFunctionLikeSignature(symbol, symbol.returnType, symbol.receiverParameter?.type, symbol.valueParameters.map { asSignature(it) })
|
||||
return KtFunctionLikeSignature(symbol, symbol.returnType, symbol.receiverType, symbol.valueParameters.map { asSignature(it) })
|
||||
}
|
||||
|
||||
override fun <S : KtVariableLikeSymbol> asSignature(symbol: S): KtVariableLikeSignature<S> {
|
||||
return KtVariableLikeSignature(symbol, symbol.returnType, symbol.receiverParameter?.type)
|
||||
return KtVariableLikeSignature(symbol, symbol.returnType, symbol.receiverType)
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -102,7 +102,7 @@ abstract class AbstractAnalysisApiSignatureContractsTest : AbstractAnalysisApiSi
|
||||
substitutor: KtSubstitutor,
|
||||
testServices: TestServices
|
||||
) {
|
||||
testServices.assertions.assertEquals(symbol.receiverParameter?.type?.let(substitutor::substitute), signature.receiverType)
|
||||
testServices.assertions.assertEquals(symbol.receiverType?.let(substitutor::substitute), signature.receiverType)
|
||||
testServices.assertions.assertEquals(symbol.returnType.let(substitutor::substitute), signature.returnType)
|
||||
|
||||
testServices.assertions.assertEquals(symbol.valueParameters.size, signature.valueParameters.size)
|
||||
@@ -118,7 +118,7 @@ abstract class AbstractAnalysisApiSignatureContractsTest : AbstractAnalysisApiSi
|
||||
substitutor: KtSubstitutor,
|
||||
testServices: TestServices
|
||||
) {
|
||||
testServices.assertions.assertEquals(symbol.receiverParameter?.type?.let(substitutor::substitute), signature.receiverType)
|
||||
testServices.assertions.assertEquals(symbol.receiverType?.let(substitutor::substitute), signature.receiverType)
|
||||
testServices.assertions.assertEquals(symbol.returnType.let(substitutor::substitute), signature.returnType)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user