Fixed KT-6673 Completion: no properties from outside class inside anonymous object
#KT-6673 Fixed
This commit is contained in:
@@ -16,12 +16,13 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.util
|
||||
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope
|
||||
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import java.util.LinkedHashSet
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope
|
||||
import java.util.HashSet
|
||||
import java.util.LinkedHashSet
|
||||
|
||||
public fun JetScope.getImplicitReceiversWithInstance(): List<ReceiverParameterDescriptor> {
|
||||
// we use a set to workaround a bug with receiver for default object present twice in the result of getImplicitReceiversHierarchy()
|
||||
@@ -32,7 +33,7 @@ public fun JetScope.getImplicitReceiversWithInstance(): List<ReceiverParameterDe
|
||||
while (current != null) {
|
||||
withInstance.add(current)
|
||||
val classDescriptor = current as? ClassDescriptor
|
||||
if (classDescriptor != null && !classDescriptor.isInner()) break
|
||||
if (classDescriptor != null && !classDescriptor.isInner() && !DescriptorUtils.isLocal(classDescriptor)) break
|
||||
current = current!!.getContainingDeclaration()
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
class A(private val xxx1: Int, val xxx2: Int) {
|
||||
private val xxx3: Int = 0
|
||||
|
||||
private val x = object : Runnable {
|
||||
override fun run() {
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// EXIST: xxx1
|
||||
// EXIST: xxx2
|
||||
// EXIST: xxx3
|
||||
// EXIST: x
|
||||
@@ -577,6 +577,12 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InsideAnonymousClass.kt")
|
||||
public void testInsideAnonymousClass() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/common/InsideAnonymousClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("JavaPackage.kt")
|
||||
public void testJavaPackage() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/common/JavaPackage.kt");
|
||||
|
||||
@@ -577,6 +577,12 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InsideAnonymousClass.kt")
|
||||
public void testInsideAnonymousClass() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/common/InsideAnonymousClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("JavaPackage.kt")
|
||||
public void testJavaPackage() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/common/JavaPackage.kt");
|
||||
|
||||
Reference in New Issue
Block a user