[K/N] Drop merging forward and real declaration in deserializer

^KT-59643
This commit is contained in:
Pavel Kunyavskiy
2023-07-11 14:05:34 +02:00
committed by Space Team
parent e4c2fa1080
commit d797505f06
15 changed files with 19 additions and 126 deletions
@@ -1,17 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.descriptors.deserialization
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.types.SimpleType
interface PlatformDependentTypeTransformer {
fun transformPlatformType(classId: ClassId, computedType: SimpleType): SimpleType
object None : PlatformDependentTypeTransformer {
override fun transformPlatformType(classId: ClassId, computedType: SimpleType): SimpleType = computedType
}
}
@@ -237,31 +237,6 @@ private class SimpleTypeImpl(
}
}
// Note: a hack to support class descriptor overwriting in case of K/N forward declaration replacement and other such cases
class SupposititiousSimpleType(private val realType: SimpleType, val overwrittenClass: ClassId) : SimpleType() {
private fun maybeWrap(newType: SimpleType): SupposititiousSimpleType {
return if (newType === realType) this
else SupposititiousSimpleType(newType, overwrittenClass)
}
override fun replaceAttributes(newAttributes: TypeAttributes): SimpleType =
maybeWrap(realType.replaceAttributes(newAttributes))
override fun makeNullableAsSpecified(newNullability: Boolean): SimpleType =
maybeWrap(realType.makeNullableAsSpecified(newNullability))
@TypeRefinement
override fun refine(kotlinTypeRefiner: KotlinTypeRefiner): SimpleType =
maybeWrap(realType.refine(kotlinTypeRefiner))
override val constructor: TypeConstructor = realType.constructor
override val arguments: List<TypeProjection> = realType.arguments
override val isMarkedNullable: Boolean = realType.isMarkedNullable
override val memberScope: MemberScope = realType.memberScope
override val attributes: TypeAttributes get() = realType.attributes
}
abstract class DelegatingSimpleTypeImpl(override val delegate: SimpleType) : DelegatingSimpleType() {
override fun replaceAttributes(newAttributes: TypeAttributes): SimpleType =
if (newAttributes !== attributes)