KT-14722 completion list isn't filled up for typealias to object

#KT-14722 fixed
This commit is contained in:
Simon Ogorodnik
2017-01-27 21:19:20 +03:00
committed by Simon Ogorodnik
parent e38ca44595
commit b422b0e24d
6 changed files with 90 additions and 3 deletions
@@ -36,6 +36,7 @@ import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
import org.jetbrains.kotlin.resolve.scopes.receivers.ClassQualifier
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
import org.jetbrains.kotlin.resolve.scopes.receivers.TypeAliasQualifier
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.expressions.DoubleColonLHS
import org.jetbrains.kotlin.util.supertypesWithAny
@@ -282,9 +283,8 @@ fun CallTypeAndReceiver<*, *>.receiverTypesWithIndex(
val receiverValues = if (receiverExpression != null) {
val receiverType =
bindingContext.getType(receiverExpression) ?:
(bindingContext.get(BindingContext.QUALIFIER, receiverExpression) as? ClassQualifier)?.let {
it.descriptor.classValueType
} ?:
(bindingContext.get(BindingContext.QUALIFIER, receiverExpression) as? ClassQualifier)?.descriptor?.classValueType ?:
(bindingContext.get(BindingContext.QUALIFIER, receiverExpression) as? TypeAliasQualifier)?.classDescriptor?.classValueType ?:
return emptyList()
listOf(ExpressionReceiver.create(receiverExpression, receiverType, bindingContext))
}
@@ -0,0 +1,13 @@
object Obj {
class NestedInObject {
companion object {
val inCompanion = 0
}
}
}
typealias TA = Obj.NestedInObject
val usage = TA.<caret>
// EXIST: inCompanion
@@ -0,0 +1,9 @@
object Obj {
val inObject = 1
}
typealias TA = Obj
val usage = TA.<caret>
// EXIST: inObject
@@ -0,0 +1,11 @@
class Cls {
object Obj {
val inObject = 1
}
}
typealias TA = Cls.Obj
val usage = TA.<caret>
// EXIST: inObject
@@ -1982,6 +1982,33 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
}
}
@TestMetadata("idea/idea-completion/testData/basic/common/objects")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Objects extends AbstractJSBasicCompletionTest {
public void testAllFilesPresentInObjects() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/basic/common/objects"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("PropertyFromCompanionObjectFromTypeAliasToNestedInObjectClass.kt")
public void testPropertyFromCompanionObjectFromTypeAliasToNestedInObjectClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/objects/PropertyFromCompanionObjectFromTypeAliasToNestedInObjectClass.kt");
doTest(fileName);
}
@TestMetadata("PropertyOfTypeAliasToObject.kt")
public void testPropertyOfTypeAliasToObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/objects/PropertyOfTypeAliasToObject.kt");
doTest(fileName);
}
@TestMetadata("TypeAliasToNestedObject.kt")
public void testTypeAliasToNestedObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/objects/TypeAliasToNestedObject.kt");
doTest(fileName);
}
}
@TestMetadata("idea/idea-completion/testData/basic/common/override")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -1982,6 +1982,33 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
}
}
@TestMetadata("idea/idea-completion/testData/basic/common/objects")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Objects extends AbstractJvmBasicCompletionTest {
public void testAllFilesPresentInObjects() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/basic/common/objects"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("PropertyFromCompanionObjectFromTypeAliasToNestedInObjectClass.kt")
public void testPropertyFromCompanionObjectFromTypeAliasToNestedInObjectClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/objects/PropertyFromCompanionObjectFromTypeAliasToNestedInObjectClass.kt");
doTest(fileName);
}
@TestMetadata("PropertyOfTypeAliasToObject.kt")
public void testPropertyOfTypeAliasToObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/objects/PropertyOfTypeAliasToObject.kt");
doTest(fileName);
}
@TestMetadata("TypeAliasToNestedObject.kt")
public void testTypeAliasToNestedObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/objects/TypeAliasToNestedObject.kt");
doTest(fileName);
}
}
@TestMetadata("idea/idea-completion/testData/basic/common/override")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)