KT-20506: Fix completion suggests the same value recursively
Check for excludeNonInitializedVariable via PSI, not by descriptors equality, because of bindingContext caching #KT-20506 fixed
This commit is contained in:
+2
-2
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.idea.resolve.ResolutionFacade
|
||||
import org.jetbrains.kotlin.idea.resolve.frontendService
|
||||
import org.jetbrains.kotlin.idea.util.*
|
||||
import org.jetbrains.kotlin.js.resolve.diagnostics.findPsi
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.FqNameUnsafe
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
@@ -118,8 +119,7 @@ class ReferenceVariantsHelper(
|
||||
for (element in contextElement.parentsWithSelf) {
|
||||
val parent = element.parent
|
||||
if (parent is KtVariableDeclaration && element == parent.initializer) {
|
||||
val descriptor = bindingContext[BindingContext.DECLARATION_TO_DESCRIPTOR, parent]
|
||||
return variants.filter { it != descriptor }
|
||||
return variants.filter { it.findPsi() != parent }
|
||||
}
|
||||
if (element is KtDeclaration) break // we can use variable inside lambda or anonymous object located in its initializer
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user