[NI] Create SubCallArgument for variable in VariableAsFunctionCall
If variable is generic call, then we should complete inference only after invoke resolution. It means that explicit receiver for invoke should be SubKotlinCallArgument. But, if this property has no generics, for example local property, then this property can have smartcast and such call has no type arguments -> no completion required. For such call we should store information about smart casts.
This commit is contained in:
committed by
Mikhail Zarechenskiy
parent
756f7d6e9c
commit
e4b73fcdbd
@@ -345,8 +345,17 @@ class PSICallResolver(
|
||||
}
|
||||
|
||||
// todo: review
|
||||
private fun createReceiverCallArgument(variable: SimpleKotlinResolutionCandidate): ExpressionKotlinCallArgument =
|
||||
ReceiverExpressionKotlinCallArgument(createReceiverValueWithSmartCastInfo(variable), isVariableReceiverForInvoke = true)
|
||||
private fun createReceiverCallArgument(variable: SimpleKotlinResolutionCandidate): SimpleKotlinCallArgument {
|
||||
val variableReceiver = createReceiverValueWithSmartCastInfo(variable)
|
||||
if (variableReceiver.possibleTypes.isNotEmpty()) {
|
||||
return ReceiverExpressionKotlinCallArgument(createReceiverValueWithSmartCastInfo(variable), isVariableReceiverForInvoke = true)
|
||||
}
|
||||
|
||||
val psiKotlinCall = variable.kotlinCall.psiKotlinCall
|
||||
return SubKotlinCallArgumentImpl(CallMaker.makeExternalValueArgument((variableReceiver.receiverValue as ExpressionReceiver).expression),
|
||||
psiKotlinCall.resultDataFlowInfo, psiKotlinCall.resultDataFlowInfo, variableReceiver,
|
||||
ResolvedKotlinCall.OnlyResolvedKotlinCall(variable))
|
||||
}
|
||||
|
||||
// todo: decrease hacks count
|
||||
private fun createReceiverValueWithSmartCastInfo(variable: SimpleKotlinResolutionCandidate): ReceiverValueWithSmartCastInfo {
|
||||
|
||||
Reference in New Issue
Block a user