[FIR] Introduce valueClassRepresentation to FIR

#KT-1179
This commit is contained in:
Evgeniy.Zhelenskiy
2022-03-14 16:33:05 +03:00
committed by teamcity
parent 28bf83ceac
commit b6f2513dd2
16 changed files with 131 additions and 33 deletions
@@ -40,12 +40,6 @@ abstract class IrClass :
abstract var valueClassRepresentation: ValueClassRepresentation<IrSimpleType>?
val inlineClassRepresentation: InlineClassRepresentation<IrSimpleType>?
get() = valueClassRepresentation as? InlineClassRepresentation<IrSimpleType>
val multiFieldValueClassRepresentation: MultiFieldValueClassRepresentation<IrSimpleType>?
get() = valueClassRepresentation as? MultiFieldValueClassRepresentation<IrSimpleType>
abstract var sealedSubclasses: List<IrClassSymbol>
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.descriptors.MultiFieldValueClassRepresentation
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
import org.jetbrains.kotlin.ir.types.IrSimpleType
import java.io.File
fun <D : IrAttributeContainer> D.copyAttributes(other: IrAttributeContainer?): D = apply {
@@ -55,3 +56,10 @@ val IrFunction.isStaticMethodOfClass: Boolean
val IrFunction.isPropertyAccessor: Boolean
get() = this is IrSimpleFunction && correspondingPropertySymbol != null
val IrClass.multiFieldValueClassRepresentation: MultiFieldValueClassRepresentation<IrSimpleType>?
get() = valueClassRepresentation as? MultiFieldValueClassRepresentation<IrSimpleType>
val IrClass.inlineClassRepresentation: InlineClassRepresentation<IrSimpleType>?
get() = valueClassRepresentation as? InlineClassRepresentation<IrSimpleType>
@@ -465,7 +465,7 @@ interface IrTypeSystemContext : TypeSystemContext, TypeSystemCommonSuperTypesCon
override fun TypeConstructorMarker.isMultiFieldValueClass(): Boolean =
(this as? IrClassSymbol)?.owner?.isMultiFieldValueClass == true
override fun TypeConstructorMarker.valueClassRepresentationTypeMarkersList(): List<Pair<Name, SimpleTypeMarker>>? =
override fun TypeConstructorMarker.getValueClassProperties(): List<Pair<Name, SimpleTypeMarker>>? =
(this as? IrClassSymbol)?.owner?.valueClassRepresentation?.underlyingPropertyNamesToTypes
override fun TypeConstructorMarker.isInnerClass(): Boolean =
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.ir.util
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrField
import org.jetbrains.kotlin.ir.declarations.IrProperty
import org.jetbrains.kotlin.ir.declarations.inlineClassRepresentation
import org.jetbrains.kotlin.ir.types.IrSimpleType
fun getInlineClassUnderlyingType(irClass: IrClass): IrSimpleType {