Shadowed globals filtered out too
This commit is contained in:
@@ -220,12 +220,18 @@ abstract class CompletionSessionBase(protected val configuration: CompletionSess
|
||||
return parent is JetSimpleNameExpression && !JetPsiUtil.isSelectorInQualified(parent)
|
||||
}
|
||||
|
||||
protected fun getTopLevelCallables(): Collection<DeclarationDescriptor>
|
||||
= indicesHelper.getTopLevelCallables({ prefixMatcher.prefixMatches(it) })
|
||||
protected fun getTopLevelCallables(): Collection<DeclarationDescriptor> {
|
||||
val descriptors = indicesHelper.getTopLevelCallables({ prefixMatcher.prefixMatches(it) })
|
||||
return filterShadowedNonImported(descriptors, reference!!)
|
||||
}
|
||||
|
||||
protected fun getTopLevelExtensions(): Collection<CallableDescriptor> {
|
||||
val extensions = indicesHelper.getCallableTopLevelExtensions({ prefixMatcher.prefixMatches(it) }, reference!!.expression)
|
||||
return ShadowedDeclarationsFilter(bindingContext, moduleDescriptor, project).filterNonImported(extensions, referenceVariants, reference.expression)
|
||||
val descriptors = indicesHelper.getCallableTopLevelExtensions({ prefixMatcher.prefixMatches(it) }, reference!!.expression)
|
||||
return filterShadowedNonImported(descriptors, reference)
|
||||
}
|
||||
|
||||
private fun filterShadowedNonImported(descriptors: Collection<CallableDescriptor>, reference: JetSimpleNameReference): Collection<CallableDescriptor> {
|
||||
return ShadowedDeclarationsFilter(bindingContext, moduleDescriptor, project).filterNonImported(descriptors, referenceVariants, reference.expression)
|
||||
}
|
||||
|
||||
protected fun addAllClasses(kindFilter: (ClassKind) -> Boolean) {
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package dependency
|
||||
|
||||
fun xxx(): Int = 0
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
class C {
|
||||
fun xxx(){}
|
||||
|
||||
fun f() {
|
||||
xx<caret>
|
||||
}
|
||||
}
|
||||
|
||||
// INVOCATION_COUNT: 2
|
||||
// EXIST: { lookupString: "xxx", itemText: "xxx", tailText: "()", typeText: "Unit" }
|
||||
// NOTHING_ELSE
|
||||
+6
@@ -227,6 +227,12 @@ public class MultiFileJvmBasicCompletionTestGenerated extends AbstractMultiFileJ
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("PreferMemberToGlobal")
|
||||
public void testPreferMemberToGlobal() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/multifile/PreferMemberToGlobal/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("PreferMoreSpecificExtension1")
|
||||
public void testPreferMoreSpecificExtension1() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/multifile/PreferMoreSpecificExtension1/");
|
||||
|
||||
Reference in New Issue
Block a user