Drop PropertyDescriptorImpl.setType that takes KotlinType
Only use the other setType that takes an instance of ReceiverParameterDescriptor. This will make sure that call sites can use correct receiver annotations
This commit is contained in:
+7
-1
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.descriptors.impl.PropertyGetterDescriptorImpl;
|
||||
import org.jetbrains.kotlin.descriptors.impl.PropertySetterDescriptorImpl;
|
||||
import org.jetbrains.kotlin.load.java.typeEnhancement.TypeEnhancementKt;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorFactory;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
|
||||
import java.util.List;
|
||||
@@ -138,11 +139,16 @@ public class JavaPropertyDescriptor extends PropertyDescriptorImpl implements Ja
|
||||
|
||||
enhanced.setOverriddenDescriptors(getOverriddenDescriptors());
|
||||
|
||||
ReceiverParameterDescriptor enhancedReceiver =
|
||||
enhancedReceiverType == null ? null : DescriptorFactory.createExtensionReceiverParameterForCallable(
|
||||
this, enhancedReceiverType, Annotations.Companion.getEMPTY()
|
||||
);
|
||||
|
||||
enhanced.setType(
|
||||
enhancedReturnType,
|
||||
getTypeParameters(), // TODO
|
||||
getDispatchReceiverParameter(),
|
||||
enhancedReceiverType
|
||||
enhancedReceiver
|
||||
);
|
||||
return enhanced;
|
||||
}
|
||||
|
||||
+2
-2
@@ -489,7 +489,7 @@ class LazyJavaClassMemberScope(
|
||||
propertyDescriptor.initialize(getter, null)
|
||||
|
||||
val returnType = givenType ?: computeMethodReturnType(method, c.childForMethod(propertyDescriptor, method))
|
||||
propertyDescriptor.setType(returnType, listOf(), getDispatchReceiverParameter(), null as KotlinType?)
|
||||
propertyDescriptor.setType(returnType, listOf(), getDispatchReceiverParameter(), null)
|
||||
getter.initialize(returnType)
|
||||
|
||||
return propertyDescriptor
|
||||
@@ -519,7 +519,7 @@ class LazyJavaClassMemberScope(
|
||||
/* isStaticFinal = */ false
|
||||
)
|
||||
|
||||
propertyDescriptor.setType(getterMethod.returnType!!, listOf(), getDispatchReceiverParameter(), null as KotlinType?)
|
||||
propertyDescriptor.setType(getterMethod.returnType!!, listOf(), getDispatchReceiverParameter(), null)
|
||||
|
||||
val getter = DescriptorFactory.createGetter(
|
||||
propertyDescriptor, getterMethod.annotations, /* isDefault = */false,
|
||||
|
||||
+1
-1
@@ -275,7 +275,7 @@ abstract class LazyJavaScope(protected val c: LazyJavaResolverContext) : MemberS
|
||||
|
||||
val propertyType = getPropertyType(field)
|
||||
|
||||
propertyDescriptor.setType(propertyType, listOf(), getDispatchReceiverParameter(), null as KotlinType?)
|
||||
propertyDescriptor.setType(propertyType, listOf(), getDispatchReceiverParameter(), null)
|
||||
|
||||
if (DescriptorUtils.shouldRecordInitializerForProperty(propertyDescriptor, propertyDescriptor.type)) {
|
||||
propertyDescriptor.setCompileTimeInitializer(
|
||||
|
||||
Reference in New Issue
Block a user