[NI] Temporary fix for cases related callable reference and if

For cases like if (..) ::foo else ::bar we didn't write stub resolved
calls for ::foo before call completion. Because of this, and strange
code in if we get null inside type info.
This commit is contained in:
Stanislav Erokhin
2017-06-20 13:17:42 +03:00
committed by Mikhail Zarechenskiy
parent 455c43afa8
commit 85e34163bb
@@ -191,7 +191,10 @@ internal fun createSimplePSICallArgument(
val onlyResolvedCall = ktExpression.getCall(bindingContext)?.let {
bindingContext.get(BindingContext.ONLY_RESOLVED_CALL, it)
}
val baseType = typeInfoForArgument.type?.unwrap() ?: return null
// todo hack for if expression: sometimes we not write properly type information for branches
val baseType = typeInfoForArgument.type?.unwrap() ?:
onlyResolvedCall?.candidate?.lastCall?.descriptorWithFreshTypes?.returnType?.unwrap() ?:
return null
// we should use DFI after this argument, because there can be some useful smartcast. Popular case: if branches.
val receiverToCast = transformToReceiverWithSmartCastInfo(