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:
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.descriptors.impl.PropertyGetterDescriptorImpl
|
|||||||
import org.jetbrains.kotlin.descriptors.impl.PropertySetterDescriptorImpl
|
import org.jetbrains.kotlin.descriptors.impl.PropertySetterDescriptorImpl
|
||||||
import org.jetbrains.kotlin.descriptors.impl.TypeParameterDescriptorImpl
|
import org.jetbrains.kotlin.descriptors.impl.TypeParameterDescriptorImpl
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
import org.jetbrains.kotlin.resolve.DescriptorFactory
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
|
|
||||||
@@ -95,7 +96,10 @@ open class AccessorForPropertyDescriptor private constructor(
|
|||||||
)
|
)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
setType(propertyType, emptyList<TypeParameterDescriptorImpl>(), dispatchReceiverParameter, receiverType)
|
setType(
|
||||||
|
propertyType, emptyList<TypeParameterDescriptorImpl>(), dispatchReceiverParameter,
|
||||||
|
DescriptorFactory.createExtensionReceiverParameterForCallable(this, receiverType, Annotations.EMPTY)
|
||||||
|
)
|
||||||
|
|
||||||
val getterDescriptor =
|
val getterDescriptor =
|
||||||
if (isWithSyntheticGetterAccessor) Getter(this, accessorKind) else calleeDescriptor.getter as PropertyGetterDescriptorImpl?
|
if (isWithSyntheticGetterAccessor) Getter(this, accessorKind) else calleeDescriptor.getter as PropertyGetterDescriptorImpl?
|
||||||
|
|||||||
+5
-1
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
|||||||
import org.jetbrains.kotlin.incremental.record
|
import org.jetbrains.kotlin.incremental.record
|
||||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
import org.jetbrains.kotlin.resolve.DescriptorFactory
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||||
import org.jetbrains.kotlin.resolve.scopes.*
|
import org.jetbrains.kotlin.resolve.scopes.*
|
||||||
import org.jetbrains.kotlin.storage.StorageManager
|
import org.jetbrains.kotlin.storage.StorageManager
|
||||||
@@ -337,7 +338,10 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l
|
|||||||
|
|
||||||
val propertyType = typeSubstitutor.safeSubstitute(type, Variance.INVARIANT)
|
val propertyType = typeSubstitutor.safeSubstitute(type, Variance.INVARIANT)
|
||||||
val receiverType = typeSubstitutor.safeSubstitute(ownerClass.defaultType, Variance.INVARIANT)
|
val receiverType = typeSubstitutor.safeSubstitute(ownerClass.defaultType, Variance.INVARIANT)
|
||||||
descriptor.setType(propertyType, typeParameters, null, receiverType)
|
descriptor.setType(
|
||||||
|
propertyType, typeParameters, null,
|
||||||
|
DescriptorFactory.createExtensionReceiverParameterForCallable(descriptor, receiverType, Annotations.EMPTY)
|
||||||
|
)
|
||||||
|
|
||||||
val getter = PropertyGetterDescriptorImpl(
|
val getter = PropertyGetterDescriptorImpl(
|
||||||
descriptor,
|
descriptor,
|
||||||
|
|||||||
@@ -1230,9 +1230,7 @@ public class DescriptorResolver {
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
propertyWrapper.setDescriptor(propertyDescriptor);
|
propertyWrapper.setDescriptor(propertyDescriptor);
|
||||||
propertyDescriptor.setType(
|
propertyDescriptor.setType(type, Collections.emptyList(), getDispatchReceiverParameterIfNeeded(classDescriptor), null);
|
||||||
type, Collections.emptyList(), getDispatchReceiverParameterIfNeeded(classDescriptor), (ReceiverParameterDescriptor) null
|
|
||||||
);
|
|
||||||
|
|
||||||
Annotations setterAnnotations = annotationSplitter.getAnnotationsForTarget(PROPERTY_SETTER);
|
Annotations setterAnnotations = annotationSplitter.getAnnotationsForTarget(PROPERTY_SETTER);
|
||||||
Annotations getterAnnotations = new CompositeAnnotations(CollectionsKt.listOf(
|
Annotations getterAnnotations = new CompositeAnnotations(CollectionsKt.listOf(
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ class LocalVariableResolver(
|
|||||||
type = variableTypeAndInitializerResolver.resolveType(propertyDescriptor, scope, variable, dataFlowInfo, trace, local = true)
|
type = variableTypeAndInitializerResolver.resolveType(propertyDescriptor, scope, variable, dataFlowInfo, trace, local = true)
|
||||||
|
|
||||||
val receiverParameter = (containingDeclaration as ScriptDescriptor).thisAsReceiverParameter
|
val receiverParameter = (containingDeclaration as ScriptDescriptor).thisAsReceiverParameter
|
||||||
propertyDescriptor.setType(type, emptyList<TypeParameterDescriptor>(), receiverParameter, null as KotlinType?)
|
propertyDescriptor.setType(type, emptyList<TypeParameterDescriptor>(), receiverParameter, null)
|
||||||
initializeWithDefaultGetterSetter(propertyDescriptor)
|
initializeWithDefaultGetterSetter(propertyDescriptor)
|
||||||
trace.record(BindingContext.VARIABLE, variable, propertyDescriptor)
|
trace.record(BindingContext.VARIABLE, variable, propertyDescriptor)
|
||||||
result = propertyDescriptor
|
result = propertyDescriptor
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class DynamicCallableDescriptors(storageManager: StorageManager, builtIns: Kotli
|
|||||||
dynamicType,
|
dynamicType,
|
||||||
createTypeParameters(propertyDescriptor, call),
|
createTypeParameters(propertyDescriptor, call),
|
||||||
createDynamicDispatchReceiverParameter(propertyDescriptor),
|
createDynamicDispatchReceiverParameter(propertyDescriptor),
|
||||||
null as KotlinType?
|
null
|
||||||
)
|
)
|
||||||
|
|
||||||
val getter = DescriptorFactory.createDefaultGetter(propertyDescriptor, Annotations.EMPTY)
|
val getter = DescriptorFactory.createDefaultGetter(propertyDescriptor, Annotations.EMPTY)
|
||||||
|
|||||||
+5
-3
@@ -7,10 +7,12 @@ package org.jetbrains.kotlin.resolve.lazy.descriptors.script
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
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.name.Name
|
||||||
import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyScriptDescriptor
|
import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyScriptDescriptor
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
|
||||||
|
|
||||||
class ScriptEnvironmentPropertyDescriptor(
|
class ScriptEnvironmentPropertyDescriptor(
|
||||||
name: Name,
|
name: Name,
|
||||||
@@ -32,7 +34,7 @@ class ScriptEnvironmentPropertyDescriptor(
|
|||||||
/* isDelegated = */ false
|
/* isDelegated = */ false
|
||||||
) {
|
) {
|
||||||
init {
|
init {
|
||||||
setType(typeDescriptor.defaultType, emptyList<TypeParameterDescriptorImpl>(), receiver, null as KotlinType?)
|
setType(typeDescriptor.defaultType, emptyList(), receiver, null)
|
||||||
initialize(
|
initialize(
|
||||||
makePropertyGetterDescriptor(),
|
makePropertyGetterDescriptor(),
|
||||||
if (!isVar) null else makePropertySetterDescriptor()
|
if (!isVar) null else makePropertySetterDescriptor()
|
||||||
|
|||||||
+2
-8
@@ -53,17 +53,11 @@ class JsDescriptorsFactory : DescriptorsFactory {
|
|||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
).apply {
|
).apply {
|
||||||
setType(
|
setType(outerClass.defaultType.toKotlinType(), emptyList(), innerClass.descriptor.thisAsReceiverParameter, null)
|
||||||
outerClass.defaultType.toKotlinType(),
|
|
||||||
emptyList(),
|
|
||||||
innerClass.descriptor.thisAsReceiverParameter,
|
|
||||||
null as? ReceiverParameterDescriptor
|
|
||||||
)
|
|
||||||
initialize(null, null)
|
initialize(null, null)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun getInnerClassConstructorWithOuterThisParameter(innerClassConstructor: IrConstructor): IrConstructorSymbol {
|
override fun getInnerClassConstructorWithOuterThisParameter(innerClassConstructor: IrConstructor): IrConstructorSymbol {
|
||||||
val innerClass = innerClassConstructor.parent as IrClass
|
val innerClass = innerClassConstructor.parent as IrClass
|
||||||
assert(innerClass.isInner) { "Class is not inner: $innerClass" }
|
assert(innerClass.isInner) { "Class is not inner: $innerClass" }
|
||||||
@@ -109,7 +103,7 @@ class JsDescriptorsFactory : DescriptorsFactory {
|
|||||||
CallableMemberDescriptor.Kind.SYNTHESIZED, SourceElement.NO_SOURCE, /* lateInit = */ false, /* isConst = */ false,
|
CallableMemberDescriptor.Kind.SYNTHESIZED, SourceElement.NO_SOURCE, /* lateInit = */ false, /* isConst = */ false,
|
||||||
/* isExpect = */ false, /* isActual = */ false, /* isExternal = */ false, /* isDelegated = */ false
|
/* isExpect = */ false, /* isActual = */ false, /* isExternal = */ false, /* isDelegated = */ false
|
||||||
).apply {
|
).apply {
|
||||||
setType(objectDescriptor.defaultType, emptyList(), null, null as ReceiverParameterDescriptor)
|
setType(objectDescriptor.defaultType, emptyList(), null, null)
|
||||||
initialize(null, null)
|
initialize(null, null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -173,8 +173,7 @@ class JsSharedVariablesManager(val builtIns: KotlinBuiltIns, val jsInterinalPack
|
|||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
|
||||||
|
desc.setType(builtIns.anyType, emptyList(), closureBoxTypeDescriptor.thisAsReceiverParameter, null)
|
||||||
desc.setType(builtIns.anyType, emptyList(), closureBoxTypeDescriptor.thisAsReceiverParameter, null as ReceiverParameterDescriptor?)
|
|
||||||
desc.initialize(null, null)
|
desc.initialize(null, null)
|
||||||
|
|
||||||
return desc
|
return desc
|
||||||
|
|||||||
+2
-1
@@ -361,7 +361,8 @@ internal class DeepCopyIrTreeWithDescriptors(val targetDescriptor: FunctionDescr
|
|||||||
/* outType = */ substituteTypeAndTryGetCopied(oldDescriptor.type)!!,
|
/* outType = */ substituteTypeAndTryGetCopied(oldDescriptor.type)!!,
|
||||||
/* typeParameters = */ oldDescriptor.typeParameters,
|
/* typeParameters = */ oldDescriptor.typeParameters,
|
||||||
/* dispatchReceiverParameter = */ (containingDeclaration as ClassDescriptor).thisAsReceiverParameter,
|
/* dispatchReceiverParameter = */ (containingDeclaration as ClassDescriptor).thisAsReceiverParameter,
|
||||||
/* receiverType = */ substituteTypeAndTryGetCopied(oldDescriptor.extensionReceiverParameter?.type))
|
/* extensionReceiverParameter= */ copyReceiverParameter(oldDescriptor.extensionReceiverParameter, this)
|
||||||
|
)
|
||||||
|
|
||||||
initialize(
|
initialize(
|
||||||
/* getter = */ oldDescriptor.getter?.let { copyPropertyGetterDescriptor(it, this) },
|
/* getter = */ oldDescriptor.getter?.let { copyPropertyGetterDescriptor(it, this) },
|
||||||
|
|||||||
+1
-1
@@ -474,7 +474,7 @@ class CallableReferenceLowering(val context: JvmBackendContext) : FileLoweringPa
|
|||||||
/* outType = */ superNameProperty.type,
|
/* outType = */ superNameProperty.type,
|
||||||
/* typeParameters = */ superNameProperty.typeParameters,
|
/* typeParameters = */ superNameProperty.typeParameters,
|
||||||
/* dispatchReceiverParameter = */ superNameProperty.dispatchReceiverParameter,
|
/* dispatchReceiverParameter = */ superNameProperty.dispatchReceiverParameter,
|
||||||
/* receiverType = */ superNameProperty.extensionReceiverParameter?.type
|
/* extensionReceiverParameter= */ superNameProperty.extensionReceiverParameter
|
||||||
)
|
)
|
||||||
//overriddenDescriptors += superNameProperty.getter
|
//overriddenDescriptors += superNameProperty.getter
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import org.jetbrains.kotlin.name.Name
|
|||||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue
|
import org.jetbrains.kotlin.resolve.constants.ConstantValue
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
import org.jetbrains.kotlin.types.TypeSubstitutor
|
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||||
import java.lang.UnsupportedOperationException
|
|
||||||
|
|
||||||
interface IrDelegateDescriptor : PropertyDescriptor
|
interface IrDelegateDescriptor : PropertyDescriptor
|
||||||
|
|
||||||
@@ -68,13 +67,7 @@ abstract class IrDelegateDescriptorBase(
|
|||||||
/* isDelegated = */ true
|
/* isDelegated = */ true
|
||||||
) {
|
) {
|
||||||
init {
|
init {
|
||||||
val typeParameters: List<TypeParameterDescriptor> = emptyList()
|
setType(delegateType, emptyList(), (containingDeclaration as? ClassDescriptor)?.thisAsReceiverParameter, null)
|
||||||
val extensionReceiverParameter: ReceiverParameterDescriptor? = null
|
|
||||||
val dispatchReceiverParameter =
|
|
||||||
if (containingDeclaration is ClassDescriptor)
|
|
||||||
containingDeclaration.thisAsReceiverParameter
|
|
||||||
else null
|
|
||||||
setType(delegateType, typeParameters, dispatchReceiverParameter, extensionReceiverParameter)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final override fun setOutType(outType: KotlinType?) {
|
final override fun setOutType(outType: KotlinType?) {
|
||||||
|
|||||||
@@ -15,21 +15,14 @@ import org.jetbrains.kotlin.ir.declarations.impl.IrFieldImpl
|
|||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrTypeParameterImpl
|
import org.jetbrains.kotlin.ir.declarations.impl.IrTypeParameterImpl
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrValueParameterImpl
|
import org.jetbrains.kotlin.ir.declarations.impl.IrValueParameterImpl
|
||||||
import org.jetbrains.kotlin.ir.expressions.*
|
import org.jetbrains.kotlin.ir.expressions.*
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
|
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrValueParameterSymbol
|
|
||||||
import org.jetbrains.kotlin.ir.types.*
|
|
||||||
import org.jetbrains.kotlin.ir.symbols.*
|
import org.jetbrains.kotlin.ir.symbols.*
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.*
|
||||||
import org.jetbrains.kotlin.ir.types.toIrType
|
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
||||||
import org.jetbrains.kotlin.resolve.source.PsiSourceElement
|
import org.jetbrains.kotlin.resolve.source.PsiSourceElement
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binds the arguments explicitly represented in the IR to the parameters of the accessed function.
|
* Binds the arguments explicitly represented in the IR to the parameters of the accessed function.
|
||||||
@@ -363,8 +356,7 @@ fun createField(
|
|||||||
).apply {
|
).apply {
|
||||||
initialize(null, null)
|
initialize(null, null)
|
||||||
|
|
||||||
val receiverType: KotlinType? = null
|
setType(type.toKotlinType(), emptyList(), owner.thisAsReceiverParameter, null)
|
||||||
setType(type.toKotlinType(), emptyList(), owner.thisAsReceiverParameter, receiverType)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return IrFieldImpl(startOffset, endOffset, origin, descriptor, type)
|
return IrFieldImpl(startOffset, endOffset, origin, descriptor, type)
|
||||||
|
|||||||
+7
-1
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.descriptors.impl.PropertyGetterDescriptorImpl;
|
|||||||
import org.jetbrains.kotlin.descriptors.impl.PropertySetterDescriptorImpl;
|
import org.jetbrains.kotlin.descriptors.impl.PropertySetterDescriptorImpl;
|
||||||
import org.jetbrains.kotlin.load.java.typeEnhancement.TypeEnhancementKt;
|
import org.jetbrains.kotlin.load.java.typeEnhancement.TypeEnhancementKt;
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
|
import org.jetbrains.kotlin.resolve.DescriptorFactory;
|
||||||
import org.jetbrains.kotlin.types.KotlinType;
|
import org.jetbrains.kotlin.types.KotlinType;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -138,11 +139,16 @@ public class JavaPropertyDescriptor extends PropertyDescriptorImpl implements Ja
|
|||||||
|
|
||||||
enhanced.setOverriddenDescriptors(getOverriddenDescriptors());
|
enhanced.setOverriddenDescriptors(getOverriddenDescriptors());
|
||||||
|
|
||||||
|
ReceiverParameterDescriptor enhancedReceiver =
|
||||||
|
enhancedReceiverType == null ? null : DescriptorFactory.createExtensionReceiverParameterForCallable(
|
||||||
|
this, enhancedReceiverType, Annotations.Companion.getEMPTY()
|
||||||
|
);
|
||||||
|
|
||||||
enhanced.setType(
|
enhanced.setType(
|
||||||
enhancedReturnType,
|
enhancedReturnType,
|
||||||
getTypeParameters(), // TODO
|
getTypeParameters(), // TODO
|
||||||
getDispatchReceiverParameter(),
|
getDispatchReceiverParameter(),
|
||||||
enhancedReceiverType
|
enhancedReceiver
|
||||||
);
|
);
|
||||||
return enhanced;
|
return enhanced;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -489,7 +489,7 @@ class LazyJavaClassMemberScope(
|
|||||||
propertyDescriptor.initialize(getter, null)
|
propertyDescriptor.initialize(getter, null)
|
||||||
|
|
||||||
val returnType = givenType ?: computeMethodReturnType(method, c.childForMethod(propertyDescriptor, method))
|
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)
|
getter.initialize(returnType)
|
||||||
|
|
||||||
return propertyDescriptor
|
return propertyDescriptor
|
||||||
@@ -519,7 +519,7 @@ class LazyJavaClassMemberScope(
|
|||||||
/* isStaticFinal = */ false
|
/* isStaticFinal = */ false
|
||||||
)
|
)
|
||||||
|
|
||||||
propertyDescriptor.setType(getterMethod.returnType!!, listOf(), getDispatchReceiverParameter(), null as KotlinType?)
|
propertyDescriptor.setType(getterMethod.returnType!!, listOf(), getDispatchReceiverParameter(), null)
|
||||||
|
|
||||||
val getter = DescriptorFactory.createGetter(
|
val getter = DescriptorFactory.createGetter(
|
||||||
propertyDescriptor, getterMethod.annotations, /* isDefault = */false,
|
propertyDescriptor, getterMethod.annotations, /* isDefault = */false,
|
||||||
|
|||||||
+1
-1
@@ -275,7 +275,7 @@ abstract class LazyJavaScope(protected val c: LazyJavaResolverContext) : MemberS
|
|||||||
|
|
||||||
val propertyType = getPropertyType(field)
|
val propertyType = getPropertyType(field)
|
||||||
|
|
||||||
propertyDescriptor.setType(propertyType, listOf(), getDispatchReceiverParameter(), null as KotlinType?)
|
propertyDescriptor.setType(propertyType, listOf(), getDispatchReceiverParameter(), null)
|
||||||
|
|
||||||
if (DescriptorUtils.shouldRecordInitializerForProperty(propertyDescriptor, propertyDescriptor.type)) {
|
if (DescriptorUtils.shouldRecordInitializerForProperty(propertyDescriptor, propertyDescriptor.type)) {
|
||||||
propertyDescriptor.setCompileTimeInitializer(
|
propertyDescriptor.setCompileTimeInitializer(
|
||||||
|
|||||||
+10
-16
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import org.jetbrains.kotlin.descriptors.*;
|
import org.jetbrains.kotlin.descriptors.*;
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorFactory;
|
import org.jetbrains.kotlin.resolve.scopes.receivers.ExtensionReceiver;
|
||||||
import org.jetbrains.kotlin.types.*;
|
import org.jetbrains.kotlin.types.*;
|
||||||
import org.jetbrains.kotlin.utils.SmartSet;
|
import org.jetbrains.kotlin.utils.SmartSet;
|
||||||
|
|
||||||
@@ -106,17 +106,6 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
|||||||
isExpect, isActual, isExternal, isDelegated);
|
isExpect, isActual, isExternal, isDelegated);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(
|
|
||||||
@NotNull KotlinType outType,
|
|
||||||
@ReadOnly @NotNull List<? extends TypeParameterDescriptor> typeParameters,
|
|
||||||
@Nullable ReceiverParameterDescriptor dispatchReceiverParameter,
|
|
||||||
@Nullable KotlinType receiverType
|
|
||||||
) {
|
|
||||||
ReceiverParameterDescriptor extensionReceiverParameter =
|
|
||||||
DescriptorFactory.createExtensionReceiverParameterForCallable(this, receiverType, Annotations.Companion.getEMPTY());
|
|
||||||
setType(outType, typeParameters, dispatchReceiverParameter, extensionReceiverParameter);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(
|
public void setType(
|
||||||
@NotNull KotlinType outType,
|
@NotNull KotlinType outType,
|
||||||
@ReadOnly @NotNull List<? extends TypeParameterDescriptor> typeParameters,
|
@ReadOnly @NotNull List<? extends TypeParameterDescriptor> typeParameters,
|
||||||
@@ -366,16 +355,21 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
|||||||
substitutedDispatchReceiver = null;
|
substitutedDispatchReceiver = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
KotlinType substitutedReceiverType;
|
ReceiverParameterDescriptor substitutedExtensionReceiver;
|
||||||
if (extensionReceiverParameter != null) {
|
if (extensionReceiverParameter != null) {
|
||||||
substitutedReceiverType = substitutor.substitute(extensionReceiverParameter.getType(), Variance.IN_VARIANCE);
|
KotlinType substitutedReceiverType = substitutor.substitute(extensionReceiverParameter.getType(), Variance.IN_VARIANCE);
|
||||||
if (substitutedReceiverType == null) return null;
|
if (substitutedReceiverType == null) return null;
|
||||||
|
substitutedExtensionReceiver = new ReceiverParameterDescriptorImpl(
|
||||||
|
substitutedDescriptor,
|
||||||
|
new ExtensionReceiver(substitutedDescriptor, substitutedReceiverType, extensionReceiverParameter.getValue()),
|
||||||
|
extensionReceiverParameter.getAnnotations()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
substitutedReceiverType = null;
|
substitutedExtensionReceiver = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
substitutedDescriptor.setType(outType, substitutedTypeParameters, substitutedDispatchReceiver, substitutedReceiverType);
|
substitutedDescriptor.setType(outType, substitutedTypeParameters, substitutedDispatchReceiver, substitutedExtensionReceiver);
|
||||||
|
|
||||||
PropertyGetterDescriptorImpl newGetter = getter == null ? null : new PropertyGetterDescriptorImpl(
|
PropertyGetterDescriptorImpl newGetter = getter == null ? null : new PropertyGetterDescriptorImpl(
|
||||||
substitutedDescriptor, getter.getAnnotations(), copyConfiguration.modality, normalizeVisibility(getter.getVisibility(), copyConfiguration.kind),
|
substitutedDescriptor, getter.getAnnotations(), copyConfiguration.modality, normalizeVisibility(getter.getVisibility(), copyConfiguration.kind),
|
||||||
|
|||||||
@@ -431,11 +431,7 @@ public class ErrorUtils {
|
|||||||
SourceElement.NO_SOURCE,
|
SourceElement.NO_SOURCE,
|
||||||
false, false, false, false, false, false
|
false, false, false, false, false, false
|
||||||
);
|
);
|
||||||
descriptor.setType(ERROR_PROPERTY_TYPE,
|
descriptor.setType(ERROR_PROPERTY_TYPE, Collections.<TypeParameterDescriptor>emptyList(), null, null);
|
||||||
Collections.<TypeParameterDescriptor>emptyList(),
|
|
||||||
null,
|
|
||||||
(KotlinType) null
|
|
||||||
);
|
|
||||||
|
|
||||||
return descriptor;
|
return descriptor;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -63,7 +63,9 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
|||||||
local.typeDeserializer.type(proto.returnType(c.typeTable)),
|
local.typeDeserializer.type(proto.returnType(c.typeTable)),
|
||||||
local.typeDeserializer.ownTypeParameters,
|
local.typeDeserializer.ownTypeParameters,
|
||||||
getDispatchReceiverParameter(),
|
getDispatchReceiverParameter(),
|
||||||
proto.receiverType(c.typeTable)?.let { local.typeDeserializer.type(it, receiverAnnotations) }
|
proto.receiverType(c.typeTable)?.let { local.typeDeserializer.type(it, receiverAnnotations) }?.let { receiverType ->
|
||||||
|
DescriptorFactory.createExtensionReceiverParameterForCallable(property, receiverType, Annotations.EMPTY)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
val getter = if (hasGetter) {
|
val getter = if (hasGetter) {
|
||||||
|
|||||||
+2
-1
@@ -123,7 +123,8 @@ private fun genProperty(
|
|||||||
flexibleType,
|
flexibleType,
|
||||||
emptyList<TypeParameterDescriptor>(),
|
emptyList<TypeParameterDescriptor>(),
|
||||||
null,
|
null,
|
||||||
receiverType)
|
DescriptorFactory.createExtensionReceiverParameterForCallable(property, receiverType, Annotations.EMPTY)
|
||||||
|
)
|
||||||
|
|
||||||
val getter = PropertyGetterDescriptorImpl(
|
val getter = PropertyGetterDescriptorImpl(
|
||||||
property,
|
property,
|
||||||
|
|||||||
Reference in New Issue
Block a user