Receiver refactoring in DataFlowValueFactory

This commit is contained in:
Mikhail Glukhikh
2015-11-17 10:39:41 +03:00
parent e56b898a53
commit f1034dbf19
3 changed files with 8 additions and 9 deletions
@@ -178,7 +178,7 @@ data class ExtractionData(
val typeInfo = context[BindingContext.EXPRESSION_TYPE_INFO, expression] ?: return emptySet()
(resolvedCall?.getImplicitReceiverValue() as? ThisReceiver)?.let {
return typeInfo.dataFlowInfo.getPossibleTypes(DataFlowValueFactory.createDataFlowValue(it))
return typeInfo.dataFlowInfo.getPossibleTypes(DataFlowValueFactory.createDataFlowValueForStableReceiver(it))
}
val type = resolvedCall?.resultingDescriptor?.returnType ?: return emptySet()
@@ -281,7 +281,7 @@ private fun suggestParameterType(
val calleeExpression = resolvedCall!!.call.calleeExpression
val typeByDataFlowInfo = if (useSmartCastsIfPossible) {
bindingContext[BindingContext.EXPRESSION_TYPE_INFO, calleeExpression]?.dataFlowInfo?.let { dataFlowInfo ->
val possibleTypes = dataFlowInfo.getPossibleTypes(DataFlowValueFactory.createDataFlowValue(receiverToExtract))
val possibleTypes = dataFlowInfo.getPossibleTypes(DataFlowValueFactory.createDataFlowValueForStableReceiver(receiverToExtract))
if (possibleTypes.isNotEmpty()) CommonSupertypes.commonSupertype(possibleTypes) else null
}
} else null