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
@@ -24,7 +24,6 @@ import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.constants.ConstantValue
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeSubstitutor
import java.lang.UnsupportedOperationException
interface IrDelegateDescriptor : PropertyDescriptor
@@ -68,13 +67,7 @@ abstract class IrDelegateDescriptorBase(
/* isDelegated = */ true
) {
init {
val typeParameters: List<TypeParameterDescriptor> = emptyList()
val extensionReceiverParameter: ReceiverParameterDescriptor? = null
val dispatchReceiverParameter =
if (containingDeclaration is ClassDescriptor)
containingDeclaration.thisAsReceiverParameter
else null
setType(delegateType, typeParameters, dispatchReceiverParameter, extensionReceiverParameter)
setType(delegateType, emptyList(), (containingDeclaration as? ClassDescriptor)?.thisAsReceiverParameter, null)
}
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.IrValueParameterImpl
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.types.IrType
import org.jetbrains.kotlin.ir.types.toIrType
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.psiUtil.endOffset
import org.jetbrains.kotlin.psi.psiUtil.startOffset
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
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.
@@ -363,8 +356,7 @@ fun createField(
).apply {
initialize(null, null)
val receiverType: KotlinType? = null
setType(type.toKotlinType(), emptyList(), owner.thisAsReceiverParameter, receiverType)
setType(type.toKotlinType(), emptyList(), owner.thisAsReceiverParameter, null)
}
return IrFieldImpl(startOffset, endOffset, origin, descriptor, type)