KT-12797: Fix completion to show inner classes from base class
#KT-12797 fixed
This commit is contained in:
+20
-4
@@ -269,7 +269,11 @@ class ReferenceVariantsHelper(
|
||||
}
|
||||
else {
|
||||
// process non-instance members and class constructors
|
||||
descriptors.addNonExtensionCallablesAndConstructors(resolutionScope, kindFilter, nameFilter, constructorFilter = { !it.isInner })
|
||||
descriptors.addNonExtensionCallablesAndConstructors(
|
||||
resolutionScope,
|
||||
kindFilter, nameFilter, constructorFilter = { !it.isInner },
|
||||
classesOnly = false
|
||||
)
|
||||
}
|
||||
return descriptors
|
||||
}
|
||||
@@ -328,7 +332,18 @@ class ReferenceVariantsHelper(
|
||||
constructorFilter: (ClassDescriptor) -> Boolean
|
||||
) {
|
||||
for (receiverType in receiverTypes) {
|
||||
addNonExtensionCallablesAndConstructors(receiverType.memberScope.memberScopeAsImportingScope(), kindFilter, nameFilter, constructorFilter)
|
||||
addNonExtensionCallablesAndConstructors(
|
||||
receiverType.memberScope.memberScopeAsImportingScope(),
|
||||
kindFilter, nameFilter, constructorFilter,
|
||||
false
|
||||
)
|
||||
receiverType.constructor.supertypes.forEach {
|
||||
addNonExtensionCallablesAndConstructors(
|
||||
it.memberScope.memberScopeAsImportingScope(),
|
||||
kindFilter, nameFilter, constructorFilter,
|
||||
true
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,7 +351,8 @@ class ReferenceVariantsHelper(
|
||||
scope: HierarchicalScope,
|
||||
kindFilter: DescriptorKindFilter,
|
||||
nameFilter: (Name) -> Boolean,
|
||||
constructorFilter: (ClassDescriptor) -> Boolean
|
||||
constructorFilter: (ClassDescriptor) -> Boolean,
|
||||
classesOnly: Boolean
|
||||
) {
|
||||
var filterToUse = DescriptorKindFilter(kindFilter.kindMask and DescriptorKindFilter.CALLABLES.kindMask).exclude(DescriptorKindExclude.Extensions)
|
||||
|
||||
@@ -351,7 +367,7 @@ class ReferenceVariantsHelper(
|
||||
if (!constructorFilter(descriptor)) continue
|
||||
descriptor.constructors.filterTo(this) { kindFilter.accepts(it) }
|
||||
}
|
||||
else if (kindFilter.accepts(descriptor)) {
|
||||
else if (!classesOnly && kindFilter.accepts(descriptor)) {
|
||||
this.add(descriptor)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
abstract class A {
|
||||
inner class InnerInA
|
||||
}
|
||||
|
||||
abstract class B : A() {
|
||||
inner class InnerInB
|
||||
}
|
||||
|
||||
fun foo(b: B) {
|
||||
val v = b.InnerIn<caret>
|
||||
}
|
||||
|
||||
// EXIST: InnerInB
|
||||
// EXIST: InnerInA
|
||||
+6
@@ -470,6 +470,12 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InnerInBaseClass.kt")
|
||||
public void testInnerInBaseClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/InnerInBaseClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InsideAnonymousClass.kt")
|
||||
public void testInsideAnonymousClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/InsideAnonymousClass.kt");
|
||||
|
||||
+6
@@ -470,6 +470,12 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InnerInBaseClass.kt")
|
||||
public void testInnerInBaseClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/InnerInBaseClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InsideAnonymousClass.kt")
|
||||
public void testInsideAnonymousClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/InsideAnonymousClass.kt");
|
||||
|
||||
Reference in New Issue
Block a user