From deb8e1f9db85384feb5f5b2360c146810edcf766 Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Tue, 5 May 2020 11:33:15 -0700 Subject: [PATCH] IR: cleanup unused implementation in WrappedDescriptors This is partial revert of 08ca6f5, which set metadata field of IR symbols during FIR2IR conversion, triggering some paths in IR codegen to use wrapped descriptors copy builder and others to serialize. Now FIR element-based metadata serialization is in, those additions were not needed anymore. --- .../ir/descriptors/WrappedDescriptors.kt | 113 +----------------- 1 file changed, 6 insertions(+), 107 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/WrappedDescriptors.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/WrappedDescriptors.kt index 4d062c68a6d..5d4a69faa75 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/WrappedDescriptors.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/WrappedDescriptors.kt @@ -252,7 +252,7 @@ open class WrappedTypeParameterDescriptor( override fun getUpperBounds() = owner.superTypes.map { it.toKotlinType() } - private val _typeConstryuctor: TypeConstructor by lazy { + private val _typeConstructor: TypeConstructor by lazy { object : AbstractTypeConstructor(LockBasedStorageManager.NO_LOCKS) { override fun computeSupertypes() = upperBounds @@ -270,7 +270,7 @@ open class WrappedTypeParameterDescriptor( } } - override fun getTypeConstructor() = _typeConstryuctor + override fun getTypeConstructor() = _typeConstructor override fun getOriginal() = this @@ -443,110 +443,7 @@ open class WrappedSimpleFunctionDescriptor( override fun getUserData(key: CallableDescriptor.UserDataKey?): V? = null override fun newCopyBuilder(): FunctionDescriptor.CopyBuilder { - // Use the original descriptor's copy builder if available. - // make sure that the original descriptor is not `this`. Otherwise, newCopyBuilder ends up with stack overflow. - if (originalDescriptor != this && originalDescriptor is SimpleFunctionDescriptor) { - return (originalDescriptor as SimpleFunctionDescriptor).newCopyBuilder(); - } - // Otherwise, return a fake copy builder that will eventually return the same wrapped descriptor. - // TODO: it is unclear whether IR lowering really needs a deep copy (and a fake copy is okay by chance). - return object : FunctionDescriptor.CopyBuilder { - override fun setOwner(owner: DeclarationDescriptor): FunctionDescriptor.CopyBuilder { - return this - } - - override fun setModality(modality: Modality): FunctionDescriptor.CopyBuilder { - return this - } - - override fun setVisibility(visibility: Visibility): FunctionDescriptor.CopyBuilder { - return this - } - - override fun setKind(kind: CallableMemberDescriptor.Kind): FunctionDescriptor.CopyBuilder { - return this - } - - override fun setCopyOverrides(copyOverrides: Boolean): FunctionDescriptor.CopyBuilder { - return this - } - - override fun setName(name: Name): FunctionDescriptor.CopyBuilder { - return this - } - - override fun setValueParameters(parameters: MutableList): - FunctionDescriptor.CopyBuilder { - return this - } - - override fun setTypeParameters( - parameters: MutableList - ): FunctionDescriptor.CopyBuilder { - return this - } - - override fun setReturnType(type: KotlinType): FunctionDescriptor.CopyBuilder { - return this - } - - override fun setExtensionReceiverParameter( - extensionReceiverParameter: ReceiverParameterDescriptor? - ): FunctionDescriptor.CopyBuilder { - return this - } - - override fun setDispatchReceiverParameter( - dispatchReceiverParameter: ReceiverParameterDescriptor? - ): FunctionDescriptor.CopyBuilder { - return this - } - - override fun setOriginal(original: CallableMemberDescriptor?): FunctionDescriptor.CopyBuilder { - return this - } - - override fun setSignatureChange(): FunctionDescriptor.CopyBuilder { - return this - } - - override fun setPreserveSourceElement(): FunctionDescriptor.CopyBuilder { - return this - } - - override fun setDropOriginalInContainingParts(): FunctionDescriptor.CopyBuilder { - return this - } - - override fun setHiddenToOvercomeSignatureClash(): FunctionDescriptor.CopyBuilder { - return this - } - - override fun setHiddenForResolutionEverywhereBesideSupercalls(): FunctionDescriptor.CopyBuilder { - return this - } - - override fun setAdditionalAnnotations( - additionalAnnotations: Annotations - ): FunctionDescriptor.CopyBuilder { - return this - } - - override fun setSubstitution(substitution: TypeSubstitution): FunctionDescriptor.CopyBuilder { - return this - } - - override fun putUserData( - userDataKey: CallableDescriptor.UserDataKey, - value: V - ): FunctionDescriptor.CopyBuilder { - return this - } - - override fun build(): SimpleFunctionDescriptor? { - return this@WrappedSimpleFunctionDescriptor - } - } + TODO("not implemented") } override fun accept(visitor: DeclarationDescriptorVisitor?, data: D) = @@ -707,7 +604,9 @@ open class WrappedClassDescriptor( override fun getDeclaredTypeParameters() = owner.typeParameters.map { it.descriptor } - override fun getSealedSubclasses(): Collection = emptyList() + override fun getSealedSubclasses(): Collection { + TODO("not implemented") + } override fun getOriginal() = this