FIR: Fix interface delegation ABI

- Unifies the name of the `$$delegate_<n>` field between K1 and K2.
- Make the `$$delegate_<n>` field private
This commit is contained in:
Steven Schäfer
2022-11-16 18:27:56 +01:00
committed by Space Team
parent 91749737f8
commit a7ba081d22
44 changed files with 232 additions and 233 deletions
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.descriptors.impl.PropertyDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.VariableDescriptorImpl
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.name.SpecialNames
import org.jetbrains.kotlin.resolve.constants.ConstantValue
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeSubstitutor
@@ -97,7 +98,7 @@ class IrPropertyDelegateDescriptorImpl(
) :
IrDelegateDescriptorBase(
correspondingProperty.containingDeclaration,
getDelegateName(correspondingProperty.name),
SpecialNames.propertyDelegateName(correspondingProperty.name),
delegateType,
correspondingProperty.delegateField?.annotations ?: Annotations.EMPTY
),
@@ -111,14 +112,11 @@ class IrImplementingDelegateDescriptorImpl(
) :
IrDelegateDescriptorBase(
containingDeclaration,
Name.identifier("\$\$delegate_$number"),
SpecialNames.delegateFieldName(number),
delegateType
),
IrImplementingDelegateDescriptor
internal fun getDelegateName(name: Name): Name =
Name.identifier(name.asString() + "\$delegate")
class IrLocalDelegatedPropertyDelegateDescriptorImpl(
override val correspondingLocalProperty: VariableDescriptorWithAccessors,
delegateType: KotlinType,
@@ -127,16 +125,16 @@ class IrLocalDelegatedPropertyDelegateDescriptorImpl(
VariableDescriptorImpl(
correspondingLocalProperty.containingDeclaration,
Annotations.EMPTY,
getDelegateName(correspondingLocalProperty.name),
SpecialNames.propertyDelegateName(correspondingLocalProperty.name),
delegateType,
org.jetbrains.kotlin.descriptors.SourceElement.NO_SOURCE
SourceElement.NO_SOURCE
) {
override fun getCompileTimeInitializer(): ConstantValue<*>? = null
override fun cleanCompileTimeInitializerCache() {}
override fun isVar(): Boolean = false
override fun isLateInit(): Boolean = false
override fun substitute(substitutor: TypeSubstitutor): VariableDescriptor? = throw UnsupportedOperationException()
override fun substitute(substitutor: TypeSubstitutor): VariableDescriptor = throw UnsupportedOperationException()
override fun getVisibility(): DescriptorVisibility = DescriptorVisibilities.LOCAL
override fun <R : Any?, D : Any?> accept(visitor: DeclarationDescriptorVisitor<R, D>, data: D): R =