KT-15141 Bogus import popup for when function call cannot be resolved fully

#KT-15141 fixed
This commit is contained in:
Simon Ogorodnik
2016-12-26 21:06:56 +03:00
committed by Simon Ogorodnik
parent db8edb01c3
commit c5e3f0ad01
@@ -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)))