From 122b14dd7d4f942bdaba546a59e01f339c38782c Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Fri, 28 Nov 2014 13:30:05 +0300 Subject: [PATCH] More accurate filtering of extensions --- .../jet/plugin/codeInsight/ReferenceVariantsHelper.kt | 6 ++---- .../src/org/jetbrains/jet/plugin/util/extensionsUtils.kt | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/idea/ide-common/src/org/jetbrains/jet/plugin/codeInsight/ReferenceVariantsHelper.kt b/idea/ide-common/src/org/jetbrains/jet/plugin/codeInsight/ReferenceVariantsHelper.kt index ff2141b9587..a7af3ed1ac0 100644 --- a/idea/ide-common/src/org/jetbrains/jet/plugin/codeInsight/ReferenceVariantsHelper.kt +++ b/idea/ide-common/src/org/jetbrains/jet/plugin/codeInsight/ReferenceVariantsHelper.kt @@ -144,10 +144,8 @@ public class ReferenceVariantsHelper( nameFilter: (Name) -> Boolean ) { if (!kindFilter.excludes.contains(DescriptorKindExclude.Extensions)) { - resolutionScope.getDescriptorsFiltered(kindFilter, nameFilter) - .stream() - .filterIsInstance(javaClass()) - .filterTo(this) { it.isExtensionCallable(receiver, isInfixCall, context, dataFlowInfo) } + resolutionScope.getDescriptorsFiltered(kindFilter.exclude(DescriptorKindExclude.NonExtensions), nameFilter) + .filterTo(this) { (it as CallableDescriptor).isExtensionCallable(receiver, isInfixCall, context, dataFlowInfo) } } } diff --git a/idea/ide-common/src/org/jetbrains/jet/plugin/util/extensionsUtils.kt b/idea/ide-common/src/org/jetbrains/jet/plugin/util/extensionsUtils.kt index 64c7024d2b4..919ad6389fd 100644 --- a/idea/ide-common/src/org/jetbrains/jet/plugin/util/extensionsUtils.kt +++ b/idea/ide-common/src/org/jetbrains/jet/plugin/util/extensionsUtils.kt @@ -49,6 +49,8 @@ public fun CallableDescriptor.isExtensionCallable( bindingContext: BindingContext, dataFlowInfo: DataFlowInfo ): Boolean { + assert(getExtensionReceiverParameter() != null) + if (isInfixCall && (this !is SimpleFunctionDescriptor || getValueParameters().size() != 1)) { return false }