KT-15141 Bogus import popup for when function call cannot be resolved fully
#KT-15141 fixed
This commit is contained in:
committed by
Simon Ogorodnik
parent
db8edb01c3
commit
c5e3f0ad01
@@ -506,10 +506,12 @@ internal class ImportForMismatchingArgumentsFix(
|
|||||||
val resolutionFacade = file.getResolutionFacade()
|
val resolutionFacade = file.getResolutionFacade()
|
||||||
val resolutionScope = elementToAnalyze.getResolutionScope(bindingContext, resolutionFacade)
|
val resolutionScope = elementToAnalyze.getResolutionScope(bindingContext, resolutionFacade)
|
||||||
|
|
||||||
|
val imported = resolutionScope.collectFunctions(identifier, NoLookupLocation.FROM_IDE)
|
||||||
|
|
||||||
fun filterFunction(descriptor: FunctionDescriptor): Boolean {
|
fun filterFunction(descriptor: FunctionDescriptor): Boolean {
|
||||||
if (!callTypeAndReceiver.callType.descriptorKindFilter.accepts(descriptor)) return false
|
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
|
// check that this function matches all arguments
|
||||||
val resolutionScopeWithAddedImport = resolutionScope.addImportingScope(ExplicitImportsScope(listOf(descriptor)))
|
val resolutionScopeWithAddedImport = resolutionScope.addImportingScope(ExplicitImportsScope(listOf(descriptor)))
|
||||||
|
|||||||
Reference in New Issue
Block a user