From c5e3f0ad01b2f4e580378d5c1d4cbaa199d5f1bb Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Mon, 26 Dec 2016 21:06:56 +0300 Subject: [PATCH] KT-15141 Bogus import popup for when function call cannot be resolved fully #KT-15141 fixed --- idea/src/org/jetbrains/kotlin/idea/quickfix/ImportFix.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/ImportFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/ImportFix.kt index eb5ba415fdf..60e0d7df4ff 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/ImportFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/ImportFix.kt @@ -506,10 +506,12 @@ internal class ImportForMismatchingArgumentsFix( val resolutionFacade = file.getResolutionFacade() val resolutionScope = elementToAnalyze.getResolutionScope(bindingContext, resolutionFacade) + val imported = resolutionScope.collectFunctions(identifier, NoLookupLocation.FROM_IDE) + fun filterFunction(descriptor: FunctionDescriptor): Boolean { if (!callTypeAndReceiver.callType.descriptorKindFilter.accepts(descriptor)) return false - if (descriptor in resolutionScope.collectFunctions(identifier, NoLookupLocation.FROM_IDE)) return false // already imported + if (descriptor.original in imported) return false // already imported // check that this function matches all arguments val resolutionScopeWithAddedImport = resolutionScope.addImportingScope(ExplicitImportsScope(listOf(descriptor)))