From 7a02bdae232d88315341b16d20c43a008819ba71 Mon Sep 17 00:00:00 2001 From: Alexey Sedunov Date: Fri, 17 Apr 2015 14:09:35 +0300 Subject: [PATCH] Extraction Engine: Fix implicit "this" analysis under smart-casts --- .../introduce/extractionEngine/extractableAnalysisUtil.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractionEngine/extractableAnalysisUtil.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractionEngine/extractableAnalysisUtil.kt index d171c3a8a36..f5315b3244f 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractionEngine/extractableAnalysisUtil.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractionEngine/extractableAnalysisUtil.kt @@ -673,8 +673,8 @@ private fun ExtractionData.inferParametersInfo( receiverToExtract is ThisReceiver -> { val calleeExpression = resolvedCall!!.getCall().getCalleeExpression() bindingContext[BindingContext.EXPRESSION_DATA_FLOW_INFO, calleeExpression]?.let { dataFlowInfo -> - val possibleTypes = dataFlowInfo.getPossibleTypes(DataFlowValueFactory.createDataFlowValue(receiverToExtract), true) - CommonSupertypes.commonSupertype(possibleTypes) + val possibleTypes = dataFlowInfo.getPossibleTypes(DataFlowValueFactory.createDataFlowValue(receiverToExtract)) + if (possibleTypes.isNotEmpty()) CommonSupertypes.commonSupertype(possibleTypes) else null } ?: receiverToExtract.getType() } receiverToExtract.exists() -> receiverToExtract.getType()