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 }