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:
Alexander Udalov
2018-08-08 17:46:00 +02:00
parent 34c033bcaf
commit ab441dcd96
19 changed files with 53 additions and 67 deletions
@@ -1230,9 +1230,7 @@ public class DescriptorResolver {
false
);
propertyWrapper.setDescriptor(propertyDescriptor);
propertyDescriptor.setType(
type, Collections.emptyList(), getDispatchReceiverParameterIfNeeded(classDescriptor), (ReceiverParameterDescriptor) null
);
propertyDescriptor.setType(type, Collections.emptyList(), getDispatchReceiverParameterIfNeeded(classDescriptor), null);
Annotations setterAnnotations = annotationSplitter.getAnnotationsForTarget(PROPERTY_SETTER);
Annotations getterAnnotations = new CompositeAnnotations(CollectionsKt.listOf(
@@ -179,7 +179,7 @@ class LocalVariableResolver(
type = variableTypeAndInitializerResolver.resolveType(propertyDescriptor, scope, variable, dataFlowInfo, trace, local = true)
val receiverParameter = (containingDeclaration as ScriptDescriptor).thisAsReceiverParameter
propertyDescriptor.setType(type, emptyList<TypeParameterDescriptor>(), receiverParameter, null as KotlinType?)
propertyDescriptor.setType(type, emptyList<TypeParameterDescriptor>(), receiverParameter, null)
initializeWithDefaultGetterSetter(propertyDescriptor)
trace.record(BindingContext.VARIABLE, variable, propertyDescriptor)
result = propertyDescriptor
@@ -104,7 +104,7 @@ class DynamicCallableDescriptors(storageManager: StorageManager, builtIns: Kotli
dynamicType,
createTypeParameters(propertyDescriptor, call),
createDynamicDispatchReceiverParameter(propertyDescriptor),
null as KotlinType?
null
)
val getter = DescriptorFactory.createDefaultGetter(propertyDescriptor, Annotations.EMPTY)
@@ -7,10 +7,12 @@ package org.jetbrains.kotlin.resolve.lazy.descriptors.script
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.descriptors.impl.*
import org.jetbrains.kotlin.descriptors.impl.PropertyDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.PropertyGetterDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.PropertySetterDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyScriptDescriptor
import org.jetbrains.kotlin.types.KotlinType
class ScriptEnvironmentPropertyDescriptor(
name: Name,
@@ -32,7 +34,7 @@ class ScriptEnvironmentPropertyDescriptor(
/* isDelegated = */ false
) {
init {
setType(typeDescriptor.defaultType, emptyList<TypeParameterDescriptorImpl>(), receiver, null as KotlinType?)
setType(typeDescriptor.defaultType, emptyList(), receiver, null)
initialize(
makePropertyGetterDescriptor(),
if (!isVar) null else makePropertySetterDescriptor()