From 1df39ab82bda0236146770ff537d3195334e0499 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Wed, 1 Apr 2015 20:01:39 +0300 Subject: [PATCH] Fixed code after rebase to SmartCastUtils requiring containingDeclaration --- .../jetbrains/kotlin/idea/caches/KotlinIndicesHelper.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/caches/KotlinIndicesHelper.kt b/idea/src/org/jetbrains/kotlin/idea/caches/KotlinIndicesHelper.kt index f72e43480d2..0b35a27d265 100644 --- a/idea/src/org/jetbrains/kotlin/idea/caches/KotlinIndicesHelper.kt +++ b/idea/src/org/jetbrains/kotlin/idea/caches/KotlinIndicesHelper.kt @@ -85,8 +85,9 @@ public class KotlinIndicesHelper( if (receiverValues.isEmpty()) return emptyList() val dataFlowInfo = bindingContext.getDataFlowInfo(expression) + val containingDeclaration = bindingContext[BindingContext.RESOLUTION_SCOPE, expression]?.getContainingDeclaration() ?: return emptyList() - val receiverTypeNames = possibleReceiverTypeNames(receiverValues.map { it.first }, dataFlowInfo) + val receiverTypeNames = possibleReceiverTypeNames(receiverValues.map { it.first }, containingDeclaration, dataFlowInfo) val index = JetTopLevelExtensionsByReceiverTypeIndex.INSTANCE @@ -101,10 +102,10 @@ public class KotlinIndicesHelper( return findSuitableExtensions(declarations, receiverValues, dataFlowInfo, bindingContext) } - private fun possibleReceiverTypeNames(receiverValues: Collection, dataFlowInfo: DataFlowInfo): Set { + private fun possibleReceiverTypeNames(receiverValues: Collection, containingDeclaration: DeclarationDescriptor, dataFlowInfo: DataFlowInfo): Set { val result = HashSet() for (receiverValue in receiverValues) { - for (type in SmartCastUtils.getSmartCastVariants(receiverValue, bindingContext, dataFlowInfo)) { + for (type in SmartCastUtils.getSmartCastVariants(receiverValue, bindingContext, containingDeclaration, dataFlowInfo)) { result.addTypeNames(type) } }