Imports from objects: Do not create new instances on getOriginal every time
Also fixes a problem where DeclarationLookupObjectImpl didn't have stable hashCode
This commit is contained in:
@@ -29,7 +29,11 @@ class FunctionImportedFromObject(val functionFromObject: FunctionDescriptor) :
|
||||
|
||||
override fun substitute(substitutor: TypeSubstitutor) = functionFromObject.substitute(substitutor).wrap()
|
||||
|
||||
override fun getOriginal() = functionFromObject.original.wrap()
|
||||
private val _original by lazy {
|
||||
functionFromObject.original.wrap()
|
||||
}
|
||||
|
||||
override fun getOriginal() = _original
|
||||
|
||||
override fun copy(
|
||||
newOwner: DeclarationDescriptor?, modality: Modality?, visibility: Visibility?,
|
||||
@@ -46,7 +50,11 @@ class PropertyImportedFromObject(val propertyFromObject: PropertyDescriptor) :
|
||||
|
||||
override fun substitute(substitutor: TypeSubstitutor) = propertyFromObject.substitute(substitutor)?.wrap()
|
||||
|
||||
override fun getOriginal() = propertyFromObject.original.wrap()
|
||||
private val _original by lazy {
|
||||
propertyFromObject.original.wrap()
|
||||
}
|
||||
|
||||
override fun getOriginal() = _original
|
||||
|
||||
override fun copy(
|
||||
newOwner: DeclarationDescriptor?, modality: Modality?, visibility: Visibility?,
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package a
|
||||
|
||||
import a.O.uniqueName
|
||||
|
||||
object O {
|
||||
fun uniqueName() {
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
uniqueN<caret>
|
||||
}
|
||||
|
||||
// EXIST: uniqueName
|
||||
// NUMBER: 1
|
||||
+6
@@ -223,6 +223,12 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ImportedMemberFromObject.kt")
|
||||
public void testImportedMemberFromObject() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/ImportedMemberFromObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InCallExpression.kt")
|
||||
public void testInCallExpression() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/InCallExpression.kt");
|
||||
|
||||
+6
@@ -223,6 +223,12 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ImportedMemberFromObject.kt")
|
||||
public void testImportedMemberFromObject() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/ImportedMemberFromObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InCallExpression.kt")
|
||||
public void testInCallExpression() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/InCallExpression.kt");
|
||||
|
||||
Reference in New Issue
Block a user