[NI] Minor. Clarified type for arguments from lambda
This commit is contained in:
committed by
Mikhail Zarechenskiy
parent
4848f8e3da
commit
1bc68e073d
+1
-1
@@ -77,7 +77,7 @@ class KotlinResolutionCallbacksImpl(
|
|||||||
receiverType: UnwrappedType?,
|
receiverType: UnwrappedType?,
|
||||||
parameters: List<UnwrappedType>,
|
parameters: List<UnwrappedType>,
|
||||||
expectedReturnType: UnwrappedType?
|
expectedReturnType: UnwrappedType?
|
||||||
): List<KotlinCallArgument> {
|
): List<SimpleKotlinCallArgument> {
|
||||||
val psiCallArgument = lambdaArgument.psiCallArgument
|
val psiCallArgument = lambdaArgument.psiCallArgument
|
||||||
val outerCallContext = (psiCallArgument as? LambdaKotlinCallArgumentImpl)?.outerCallContext ?:
|
val outerCallContext = (psiCallArgument as? LambdaKotlinCallArgumentImpl)?.outerCallContext ?:
|
||||||
(psiCallArgument as FunctionExpressionImpl).outerCallContext
|
(psiCallArgument as FunctionExpressionImpl).outerCallContext
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ abstract class PSIKotlinCallArgument : KotlinCallArgument {
|
|||||||
override fun toString() = valueArgument.getArgumentExpression()?.text?.replace('\n', ' ') ?: valueArgument.toString()
|
override fun toString() = valueArgument.getArgumentExpression()?.text?.replace('\n', ' ') ?: valueArgument.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract class SimplePSIKotlinCallArgument : PSIKotlinCallArgument(), SimpleKotlinCallArgument
|
||||||
|
|
||||||
val KotlinCallArgument.psiCallArgument: PSIKotlinCallArgument get() {
|
val KotlinCallArgument.psiCallArgument: PSIKotlinCallArgument get() {
|
||||||
assert(this is PSIKotlinCallArgument) {
|
assert(this is PSIKotlinCallArgument) {
|
||||||
"Incorrect KotlinCallArgument: $this. Java class: ${javaClass.canonicalName}"
|
"Incorrect KotlinCallArgument: $this. Java class: ${javaClass.canonicalName}"
|
||||||
@@ -67,7 +69,7 @@ class ParseErrorKotlinCallArgument(
|
|||||||
override val valueArgument: ValueArgument,
|
override val valueArgument: ValueArgument,
|
||||||
override val dataFlowInfoAfterThisArgument: DataFlowInfo,
|
override val dataFlowInfoAfterThisArgument: DataFlowInfo,
|
||||||
builtIns: KotlinBuiltIns
|
builtIns: KotlinBuiltIns
|
||||||
): ExpressionKotlinCallArgument, PSIKotlinCallArgument() {
|
): ExpressionKotlinCallArgument, SimplePSIKotlinCallArgument() {
|
||||||
override val receiver = ReceiverValueWithSmartCastInfo(TransientReceiver(builtIns.nothingType), emptySet(), isStable = true)
|
override val receiver = ReceiverValueWithSmartCastInfo(TransientReceiver(builtIns.nothingType), emptySet(), isStable = true)
|
||||||
|
|
||||||
override val isSafeCall: Boolean get() = false
|
override val isSafeCall: Boolean get() = false
|
||||||
@@ -132,7 +134,7 @@ class SubKotlinCallArgumentImpl(
|
|||||||
override val dataFlowInfoAfterThisArgument: DataFlowInfo,
|
override val dataFlowInfoAfterThisArgument: DataFlowInfo,
|
||||||
override val receiver: ReceiverValueWithSmartCastInfo,
|
override val receiver: ReceiverValueWithSmartCastInfo,
|
||||||
override val resolvedCall: ResolvedKotlinCall.OnlyResolvedKotlinCall
|
override val resolvedCall: ResolvedKotlinCall.OnlyResolvedKotlinCall
|
||||||
): PSIKotlinCallArgument(), SubKotlinCallArgument {
|
): SimplePSIKotlinCallArgument(), SubKotlinCallArgument {
|
||||||
override val isSpread: Boolean get() = valueArgument.getSpreadElement() != null
|
override val isSpread: Boolean get() = valueArgument.getSpreadElement() != null
|
||||||
override val argumentName: Name? get() = valueArgument.getArgumentName()?.asName
|
override val argumentName: Name? get() = valueArgument.getArgumentName()?.asName
|
||||||
override val isSafeCall: Boolean get() = false
|
override val isSafeCall: Boolean get() = false
|
||||||
@@ -143,7 +145,7 @@ class ExpressionKotlinCallArgumentImpl(
|
|||||||
override val dataFlowInfoBeforeThisArgument: DataFlowInfo,
|
override val dataFlowInfoBeforeThisArgument: DataFlowInfo,
|
||||||
override val dataFlowInfoAfterThisArgument: DataFlowInfo,
|
override val dataFlowInfoAfterThisArgument: DataFlowInfo,
|
||||||
override val receiver: ReceiverValueWithSmartCastInfo
|
override val receiver: ReceiverValueWithSmartCastInfo
|
||||||
): PSIKotlinCallArgument(), ExpressionKotlinCallArgument {
|
): SimplePSIKotlinCallArgument(), ExpressionKotlinCallArgument {
|
||||||
override val isSpread: Boolean get() = valueArgument.getSpreadElement() != null
|
override val isSpread: Boolean get() = valueArgument.getSpreadElement() != null
|
||||||
override val argumentName: Name? get() = valueArgument.getArgumentName()?.asName
|
override val argumentName: Name? get() = valueArgument.getArgumentName()?.asName
|
||||||
override val isSafeCall: Boolean get() = false
|
override val isSafeCall: Boolean get() = false
|
||||||
@@ -185,7 +187,7 @@ internal fun createSimplePSICallArgument(
|
|||||||
valueArgument: ValueArgument,
|
valueArgument: ValueArgument,
|
||||||
dataFlowInfoBeforeThisArgument: DataFlowInfo,
|
dataFlowInfoBeforeThisArgument: DataFlowInfo,
|
||||||
typeInfoForArgument: KotlinTypeInfo
|
typeInfoForArgument: KotlinTypeInfo
|
||||||
): PSIKotlinCallArgument? {
|
): SimplePSIKotlinCallArgument? {
|
||||||
|
|
||||||
val ktExpression = KtPsiUtil.getLastElementDeparenthesized(valueArgument.getArgumentExpression(), statementFilter) ?: return null
|
val ktExpression = KtPsiUtil.getLastElementDeparenthesized(valueArgument.getArgumentExpression(), statementFilter) ?: return null
|
||||||
val onlyResolvedCall = ktExpression.getCall(bindingContext)?.let {
|
val onlyResolvedCall = ktExpression.getCall(bindingContext)?.let {
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ interface KotlinResolutionCallbacks {
|
|||||||
receiverType: UnwrappedType?,
|
receiverType: UnwrappedType?,
|
||||||
parameters: List<UnwrappedType>,
|
parameters: List<UnwrappedType>,
|
||||||
expectedReturnType: UnwrappedType? // null means, that return type is not proper i.e. it depends on some type variables
|
expectedReturnType: UnwrappedType? // null means, that return type is not proper i.e. it depends on some type variables
|
||||||
): List<KotlinCallArgument>
|
): List<SimpleKotlinCallArgument>
|
||||||
|
|
||||||
// todo this is hack for some client which try to read ResolvedCall from trace before all calls completed
|
// todo this is hack for some client which try to read ResolvedCall from trace before all calls completed
|
||||||
fun bindStubResolvedCallForCandidate(candidate: KotlinResolutionCandidate)
|
fun bindStubResolvedCallForCandidate(candidate: KotlinResolutionCandidate)
|
||||||
|
|||||||
Reference in New Issue
Block a user