KT-7486 Auto import inserts qualified name in companion object
#KT-7486 Fixed
This commit is contained in:
@@ -273,18 +273,16 @@ public abstract class ElementResolver protected(
|
|||||||
private fun getAnnotationsByDeclaration(resolveSession: ResolveSession, modifierList: JetModifierList, declaration: JetDeclaration): Annotations {
|
private fun getAnnotationsByDeclaration(resolveSession: ResolveSession, modifierList: JetModifierList, declaration: JetDeclaration): Annotations {
|
||||||
var descriptor = resolveSession.resolveToDescriptor(declaration)
|
var descriptor = resolveSession.resolveToDescriptor(declaration)
|
||||||
if (declaration is JetClass) {
|
if (declaration is JetClass) {
|
||||||
val jetClass = declaration
|
if (modifierList == declaration.getPrimaryConstructorModifierList()) {
|
||||||
val classDescriptor = descriptor as ClassDescriptor
|
descriptor = (descriptor as ClassDescriptor).getUnsubstitutedPrimaryConstructor()
|
||||||
if (modifierList == jetClass.getPrimaryConstructorModifierList()) {
|
|
||||||
descriptor = classDescriptor.getUnsubstitutedPrimaryConstructor()
|
|
||||||
?: error("No constructor found: ${declaration.getText()}")
|
?: error("No constructor found: ${declaration.getText()}")
|
||||||
}
|
}
|
||||||
else if (modifierList.getParent() == jetClass.getBody()) {
|
|
||||||
if (classDescriptor is LazyClassDescriptor) {
|
|
||||||
return classDescriptor.getDanglingAnnotations()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (declaration is JetClassOrObject && modifierList.getParent() == declaration.getBody() && descriptor is LazyClassDescriptor) {
|
||||||
|
return descriptor.getDanglingAnnotations()
|
||||||
|
}
|
||||||
|
|
||||||
return descriptor.getAnnotations()
|
return descriptor.getAnnotations()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class A {
|
||||||
|
pl<caret>
|
||||||
|
}
|
||||||
|
|
||||||
|
// ELEMENT: platformStatic
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import kotlin.platform.platformStatic
|
||||||
|
|
||||||
|
class A {
|
||||||
|
platformStatic<caret>
|
||||||
|
}
|
||||||
|
|
||||||
|
// ELEMENT: platformStatic
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
class A {
|
||||||
|
companion object {
|
||||||
|
pl<caret>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ELEMENT: platformStatic
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import kotlin.platform.platformStatic
|
||||||
|
|
||||||
|
class A {
|
||||||
|
companion object {
|
||||||
|
platformStatic<caret>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ELEMENT: platformStatic
|
||||||
+12
@@ -107,6 +107,18 @@ public class BasicCompletionHandlerTestGenerated extends AbstractBasicCompletion
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("PlatformStaticInClass.kt")
|
||||||
|
public void testPlatformStaticInClass() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/handlers/basic/PlatformStaticInClass.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("PlatformStaticInCompanionObject.kt")
|
||||||
|
public void testPlatformStaticInCompanionObject() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/handlers/basic/PlatformStaticInCompanionObject.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("ReplaceFunctionCallByProperty.kt")
|
@TestMetadata("ReplaceFunctionCallByProperty.kt")
|
||||||
public void testReplaceFunctionCallByProperty() throws Exception {
|
public void testReplaceFunctionCallByProperty() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/handlers/basic/ReplaceFunctionCallByProperty.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/handlers/basic/ReplaceFunctionCallByProperty.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user