IR: add IrClass.getInlineClassRepresentation, serialize/deserialize it

The change in FirDeclarationUtil is needed because in case of unsigned
types loaded from the standard library, the primary constructor for some
reason is not the first, but the second in the list of constructors.
This commit is contained in:
Alexander Udalov
2021-03-30 18:16:37 +02:00
parent 4c7f207309
commit 54befa769f
33 changed files with 950 additions and 59 deletions
@@ -182,6 +182,22 @@ class FirElementSerializer private constructor(
builder.typeTable = typeTableProto
}
val representation = (klass as? FirRegularClass)?.getInlineClassUnderlyingParameter()
if (representation != null) {
builder.inlineClassUnderlyingPropertyName = getSimpleNameIndex(representation.name)
val property = callableMembers.single {
it is FirProperty && it.receiverTypeRef == null && it.name == representation.name
}
if (!property.visibility.isPublicAPI) {
if (useTypeTable()) {
builder.inlineClassUnderlyingTypeId = typeId(representation.returnTypeRef)
} else {
builder.setInlineClassUnderlyingType(typeProto(representation.returnTypeRef))
}
}
}
if (versionRequirementTable == null) error("Version requirements must be serialized for classes: ${klass.render()}")
builder.addAllVersionRequirement(versionRequirementTable.serializeVersionRequirements(klass))
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.backend
import com.intellij.psi.PsiCompiledElement
import org.jetbrains.kotlin.KtNodeTypes
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.InlineClassRepresentation
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.fir.*
@@ -497,3 +498,14 @@ fun Fir2IrComponents.createTemporaryVariableForSafeCallConstruction(
conversionScope: Fir2IrConversionScope
): Pair<IrVariable, IrValueSymbol> =
createTemporaryVariable(receiverExpression, conversionScope, "safe_receiver")
// TODO: implement inlineClassRepresentation in FirRegularClass instead.
fun Fir2IrComponents.computeInlineClassRepresentation(klass: FirRegularClass): InlineClassRepresentation<IrSimpleType>? {
if (!klass.isInline) return null
val parameter = klass.getInlineClassUnderlyingParameter() ?: error("Inline class has no underlying parameter: ${klass.render()}")
val underlyingType = parameter.returnTypeRef.toIrType(typeConverter)
return InlineClassRepresentation(
parameter.name,
underlyingType as? IrSimpleType ?: error("Inline class underlying type is not a simple type: ${klass.render()}")
)
}
@@ -127,6 +127,10 @@ class Fir2IrClassifierStorage(
superTypes = klass.superTypeRefs.map { superTypeRef -> superTypeRef.toIrType() }
}
private fun IrClass.declareInlineClassRepresentation(klass: FirRegularClass) {
inlineClassRepresentation = computeInlineClassRepresentation(klass)
}
private fun IrClass.declareSupertypesAndTypeParameters(klass: FirClass<*>): IrClass {
declareTypeParameters(klass)
declareSupertypes(klass)
@@ -175,6 +179,7 @@ class Fir2IrClassifierStorage(
irClass.declareTypeParameters(regularClass)
irClass.setThisReceiver(regularClass.typeParameters)
irClass.declareSupertypes(regularClass)
irClass.declareInlineClassRepresentation(regularClass)
return irClass
}
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.lazy
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.fir.backend.Fir2IrComponents
import org.jetbrains.kotlin.fir.backend.computeInlineClassRepresentation
import org.jetbrains.kotlin.fir.backend.declareThisReceiverParameter
import org.jetbrains.kotlin.fir.backend.toIrType
import org.jetbrains.kotlin.fir.declarations.*
@@ -21,6 +22,7 @@ import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.lazy.lazyVar
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
import org.jetbrains.kotlin.ir.util.isFakeOverride
@@ -117,6 +119,12 @@ class Fir2IrLazyClass(
receiver
}
override var inlineClassRepresentation: InlineClassRepresentation<IrSimpleType>?
get() = computeInlineClassRepresentation(fir)
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
private val fakeOverridesByName = mutableMapOf<Name, Collection<IrDeclaration>>()
fun getFakeOverridesByName(name: Name): Collection<IrDeclaration> = fakeOverridesByName.getOrPut(name) {
@@ -29,9 +29,9 @@ internal fun ConeKotlinType.unsubstitutedUnderlyingTypeForInlineClass(session: F
?.toSymbol(session) as? FirRegularClassSymbol
?: return null
symbol.ensureResolved(FirResolvePhase.STATUS, session)
val firClass = symbol.fir
if (!firClass.status.isInline) return null
val constructor = firClass.declarations.singleOrNull { it is FirConstructor && it.isPrimary } as FirConstructor? ?: return null
val valueParameter = constructor.valueParameters.singleOrNull() ?: return null
return valueParameter.returnTypeRef.coneType
return symbol.fir.getInlineClassUnderlyingParameter()?.returnTypeRef?.coneType
}
// TODO: implement inlineClassRepresentation in FirRegularClass instead.
fun FirRegularClass.getInlineClassUnderlyingParameter(): FirValueParameter? =
if (isInline) primaryConstructor?.valueParameters?.singleOrNull() else null
@@ -155,7 +155,7 @@ val FirClass<*>.constructorsSortedByDelegation: List<FirConstructor>
get() = constructors.sortedWith(ConstructorDelegationComparator)
val FirClass<*>.primaryConstructor: FirConstructor?
get() = constructors.firstOrNull()?.takeIf { it.isPrimary }
get() = constructors.find(FirConstructor::isPrimary)
fun FirRegularClass.collectEnumEntries(): Collection<FirEnumEntry> {
assert(classKind == ClassKind.ENUM_CLASS)
@@ -15,10 +15,7 @@ import org.jetbrains.kotlin.codegen.coroutines.INVOKE_SUSPEND_METHOD_NAME
import org.jetbrains.kotlin.codegen.coroutines.SUSPEND_CALL_RESULT_NAME
import org.jetbrains.kotlin.codegen.coroutines.SUSPEND_FUNCTION_COMPLETION_PARAMETER_NAME
import org.jetbrains.kotlin.codegen.coroutines.SUSPEND_FUNCTION_CREATE_METHOD_NAME
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.ir.builders.declarations.*
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
@@ -253,6 +250,7 @@ class JvmSymbols(
klass.addConstructor { isPrimary = true }.apply {
addValueParameter("value", irBuiltIns.anyNType)
}
klass.inlineClassRepresentation = InlineClassRepresentation(Name.identifier("value"), irBuiltIns.anyNType as IrSimpleType)
}
val continuationImplClass: IrClassSymbol =
@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrReturnImpl
import org.jetbrains.kotlin.ir.expressions.mapValueParameters
import org.jetbrains.kotlin.ir.expressions.putTypeArguments
import org.jetbrains.kotlin.ir.expressions.typeParametersCount
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.util.SYNTHETIC_OFFSET
import org.jetbrains.kotlin.ir.util.createIrClassFromDescriptor
import org.jetbrains.kotlin.ir.util.declareSimpleFunctionWithOverrides
@@ -121,6 +122,11 @@ class ClassGenerator(
generateFakeOverrideMemberDeclarations(irClass, ktClassOrObject)
if (irClass.isInline && ktClassOrObject is KtClassOrObject) {
val representation = classDescriptor.inlineClassRepresentation
?: error("Unknown representation for inline class: $classDescriptor")
irClass.inlineClassRepresentation = representation.mapUnderlyingType { type ->
type.toIrType() as? IrSimpleType ?: error("Inline class underlying type is not a simple type: $classDescriptor")
}
generateAdditionalMembersForInlineClasses(irClass, ktClassOrObject)
}
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.types.impl.IrUninitializedType
import org.jetbrains.kotlin.ir.util.createIrClassFromDescriptor
import org.jetbrains.kotlin.ir.util.withScope
@@ -76,7 +77,9 @@ class StandaloneDeclarationGenerator(private val context: GeneratorContext) {
}
}
fun generateClass(startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: ClassDescriptor, symbol: IrClassSymbol): IrClass {
fun generateClass(
startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: ClassDescriptor, symbol: IrClassSymbol
): IrClass {
val irClass = irFactory.createIrClassFromDescriptor(startOffset, endOffset, origin, symbol, descriptor)
symbolTable.withScope(irClass) {
@@ -93,6 +96,8 @@ class StandaloneDeclarationGenerator(private val context: GeneratorContext) {
descriptor.thisAsReceiverParameter,
descriptor.thisAsReceiverParameter.type.toIrType()
).also { it.parent = irClass }
irClass.inlineClassRepresentation = descriptor.inlineClassRepresentation?.mapUnderlyingType { it.toIrType() as IrSimpleType }
}
return irClass
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.name.Name
@@ -64,6 +65,8 @@ class IrClassImpl(
override var superTypes: List<IrType> = emptyList()
override var inlineClassRepresentation: InlineClassRepresentation<IrSimpleType>? = null
override var metadata: MetadataSource? = null
override var attributeOwnerId: IrAttributeContainer = this
@@ -10,6 +10,7 @@ import java.util.Collections
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
import org.jetbrains.kotlin.descriptors.InlineClassRepresentation
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.SourceElement
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
@@ -27,6 +28,7 @@ import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.symbols.IrValueParameterSymbol
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.name.Name
@@ -157,5 +159,16 @@ internal class PersistentIrClass(
}
}
override var inlineClassRepresentationField: InlineClassRepresentation<IrSimpleType>? = null
override var inlineClassRepresentation: InlineClassRepresentation<IrSimpleType>?
get() = getCarrier().inlineClassRepresentationField
set(v) {
if (inlineClassRepresentation !== v) {
setCarrier()
inlineClassRepresentationField = v
}
}
override var attributeOwnerId: IrAttributeContainer = this
}
@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.ir.declarations.persistent.carriers
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
import org.jetbrains.kotlin.descriptors.InlineClassRepresentation
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
@@ -14,6 +15,7 @@ import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.symbols.IrValueParameterSymbol
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.types.IrType
// Auto-generated by compiler/ir/ir.tree.persistent/generator/src/org/jetbrains/kotlin/ir/persistentIrGenerator/Main.kt. DO NOT EDIT!
@@ -26,6 +28,7 @@ internal interface ClassCarrier : DeclarationCarrier{
val typeParametersField: List<IrTypeParameter>
val typeParametersSymbolField: List<IrTypeParameterSymbol>
val superTypesField: List<IrType>
val inlineClassRepresentationField: InlineClassRepresentation<IrSimpleType>?
override fun clone(): ClassCarrier {
return ClassCarrierImpl(
@@ -37,7 +40,8 @@ internal interface ClassCarrier : DeclarationCarrier{
visibilityField,
modalityField,
typeParametersSymbolField,
superTypesField
superTypesField,
inlineClassRepresentationField
)
}
}
@@ -51,7 +55,8 @@ internal class ClassCarrierImpl(
override val visibilityField: DescriptorVisibility,
override val modalityField: Modality,
override val typeParametersSymbolField: List<IrTypeParameterSymbol>,
override val superTypesField: List<IrType>
override val superTypesField: List<IrType>,
override val inlineClassRepresentationField: InlineClassRepresentation<IrSimpleType>?
) : ClassCarrier {
override val thisReceiverField: IrValueParameter?
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.ir.serialization
import org.jetbrains.kotlin.backend.common.serialization.codedInputStream
import org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall as ProtoIrConstructorCall
import org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation as ProtoIrInlineClassRepresentation
import org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable as ProtoIrVariable
import org.jetbrains.kotlin.backend.common.serialization.proto.PirAnonymousInitializerCarrier
import org.jetbrains.kotlin.backend.common.serialization.proto.PirClassCarrier
@@ -21,6 +22,7 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.PirTypeAliasCarri
import org.jetbrains.kotlin.backend.common.serialization.proto.PirTypeParameterCarrier
import org.jetbrains.kotlin.backend.common.serialization.proto.PirValueParameterCarrier
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
import org.jetbrains.kotlin.descriptors.InlineClassRepresentation
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.declarations.IrVariable
@@ -59,6 +61,7 @@ import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.symbols.IrValueParameterSymbol
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.protobuf.ExtensionRegistryLite
@@ -102,6 +105,8 @@ internal abstract class IrCarrierDeserializer {
abstract fun deserializeModality(proto: Long): Modality
abstract fun deserializeInlineClassRepresentation(proto: ProtoIrInlineClassRepresentation): InlineClassRepresentation<IrSimpleType>
abstract fun deserializeIsExternalClass(proto: Long): Boolean
abstract fun deserializeIsExternalField(proto: Long): Boolean
@@ -132,7 +137,8 @@ internal abstract class IrCarrierDeserializer {
deserializeVisibility(proto.flags),
deserializeModality(proto.flags),
proto.typeParametersList.map { deserializeTypeParameter(it) },
proto.superTypesList.map { deserializeSuperType(it) }
proto.superTypesList.map { deserializeSuperType(it) },
if (proto.hasInlineClassRepresentation()) deserializeInlineClassRepresentation(proto.inlineClassRepresentation) else null
)
}
@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.ir.serialization
import org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall as ProtoIrConstructorCall
import org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation as ProtoIrInlineClassRepresentation
import org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable as ProtoIrVariable
import org.jetbrains.kotlin.backend.common.serialization.proto.PirAnonymousInitializerCarrier
import org.jetbrains.kotlin.backend.common.serialization.proto.PirClassCarrier
@@ -20,6 +21,7 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.PirTypeAliasCarri
import org.jetbrains.kotlin.backend.common.serialization.proto.PirTypeParameterCarrier
import org.jetbrains.kotlin.backend.common.serialization.proto.PirValueParameterCarrier
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
import org.jetbrains.kotlin.descriptors.InlineClassRepresentation
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.declarations.IrVariable
@@ -46,6 +48,7 @@ import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.symbols.IrValueParameterSymbol
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.types.IrType
// Auto-generated by compiler/ir/ir.tree.persistent/generator/src/org/jetbrains/kotlin/ir/persistentIrGenerator/Main.kt. DO NOT EDIT!
@@ -88,6 +91,8 @@ internal abstract class IrCarrierSerializer {
abstract fun serializeModality(value: Modality): Long
abstract fun serializeInlineClassRepresentation(value: InlineClassRepresentation<IrSimpleType>): ProtoIrInlineClassRepresentation
abstract fun serializeIsExternalClass(value: Boolean): Long
abstract fun serializeIsExternalField(value: Boolean): Long
@@ -116,6 +121,7 @@ internal abstract class IrCarrierSerializer {
proto.setFlags(serializeVisibility(carrier.visibilityField) or serializeModality(carrier.modalityField))
proto.addAllTypeParameters(carrier.typeParametersSymbolField.map { serializeTypeParameter(it) })
proto.addAllSuperTypes(carrier.superTypesField.map { serializeSuperType(it) })
carrier.inlineClassRepresentationField?.let { proto.setInlineClassRepresentation(serializeInlineClassRepresentation(it)) }
return proto.build().toByteArray()
}
@@ -17,6 +17,11 @@ internal fun PersistentIrGenerator.generateClass() {
)
val superTypesField = Field("superTypes", +"List<" + import("IrType", "org.jetbrains.kotlin.ir.types") + ">", superTypeListProto)
val modalityField = Field("modality", descriptorType("Modality"), modalityProto)
val inlineClassRepresentationField = Field(
"inlineClassRepresentation",
descriptorType("InlineClassRepresentation") + "<" + import("IrSimpleType", "org.jetbrains.kotlin.ir.types") + ">?",
inlineClassRepresentationProto
)
writeFile("PersistentIrClass.kt", renderFile("org.jetbrains.kotlin.ir.declarations.persistent") {
lines(
@@ -72,6 +77,7 @@ internal fun PersistentIrGenerator.generateClass() {
superTypesField.toPersistentField(+"emptyList()"),
+"override var metadata: " + MetadataSource + "? = null",
modalityField.toPersistentField(+"modality"),
inlineClassRepresentationField.toPersistentField(+"null"),
+"override var attributeOwnerId: " + IrAttributeContainer + " = this",
),
id,
@@ -86,6 +92,7 @@ internal fun PersistentIrGenerator.generateClass() {
modalityField,
typeParametersField,
superTypesField,
inlineClassRepresentationField,
)()
})
@@ -96,5 +103,6 @@ internal fun PersistentIrGenerator.generateClass() {
modalityField,
typeParametersField,
superTypesField,
inlineClassRepresentationField,
)
}
}
@@ -3,11 +3,11 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:Suppress("MemberVisibilityCanBePrivate")
package org.jetbrains.kotlin.ir.persistentIrGenerator
import java.io.File
import java.lang.IllegalStateException
import java.lang.StringBuilder
internal interface R {
fun text(t: String): R
@@ -156,6 +156,11 @@ internal object PersistentIrGenerator {
val visibilityProto = Proto(null, "visibility", +"Long", DescriptorVisibility)
val modalityProto = Proto(null, "modality", +"Long", descriptorType("Modality"))
val inlineClassRepresentationProto = Proto(
"IrInlineClassRepresentation", "inlineClassRepresentation",
import("IrInlineClassRepresentation", protoPackage, "ProtoIrInlineClassRepresentation"),
descriptorType("InlineClassRepresentation") + "<" + import("IrSimpleType", "org.jetbrains.kotlin.ir.types") + ">"
)
val isExternalClassProto = Proto(null, "isExternalClass", +"Long", +"Boolean")
val isExternalFieldProto = Proto(null, "isExternalField", +"Long", +"Boolean")
@@ -180,6 +185,7 @@ internal object PersistentIrGenerator {
variableProto,
visibilityProto,
modalityProto,
inlineClassRepresentationProto,
isExternalClassProto,
isExternalFieldProto,
isExternalFunctionProto,
@@ -8,8 +8,8 @@ package org.jetbrains.kotlin.ir.serialization
import org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer
import org.jetbrains.kotlin.backend.common.serialization.IrFlags
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
import org.jetbrains.kotlin.descriptors.InlineClassRepresentation
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.declarations.IrVariable
import org.jetbrains.kotlin.ir.expressions.IrBlockBody
@@ -17,11 +17,12 @@ import org.jetbrains.kotlin.ir.expressions.IrBody
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.serialization.deserialization.ProtoEnumFlags
import org.jetbrains.kotlin.serialization.deserialization.descriptorVisibility
import org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall as ProtoIrConstructorCall
import org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation as ProtoIrInlineClassRepresentation
import org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable as ProtoIrVariable
internal class IrCarrierDeserializerImpl(
@@ -102,6 +103,10 @@ internal class IrCarrierDeserializerImpl(
return ProtoEnumFlags.modality(IrFlags.MODALITY.get(proto.toInt()))
}
override fun deserializeInlineClassRepresentation(proto: ProtoIrInlineClassRepresentation): InlineClassRepresentation<IrSimpleType> {
return declarationDeserializer.deserializeInlineClassRepresentation(proto)
}
override fun deserializeIsExternalClass(proto: Long): Boolean {
return IrFlags.IS_EXTERNAL_CLASS.get(proto.toInt())
}
@@ -117,4 +122,4 @@ internal class IrCarrierDeserializerImpl(
override fun deserializeIsExternalProperty(proto: Long): Boolean {
return IrFlags.IS_EXTERNAL_PROPERTY.get(proto.toInt())
}
}
}
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.ir.serialization
import org.jetbrains.kotlin.backend.common.serialization.IrFileSerializer
import org.jetbrains.kotlin.backend.common.serialization.IrFlags
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
import org.jetbrains.kotlin.descriptors.InlineClassRepresentation
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.declarations.IrVariable
@@ -16,12 +17,13 @@ import org.jetbrains.kotlin.ir.expressions.IrBody
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.metadata.deserialization.Flags
import org.jetbrains.kotlin.serialization.deserialization.ProtoEnumFlags
import org.jetbrains.kotlin.serialization.deserialization.descriptorVisibility
import org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall as ProtoIrConstructorCall
import org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation as ProtoIrInlineClassRepresentation
import org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable as ProtoIrVariable
internal class IrCarrierSerializerImpl(val fileSerializer: IrFileSerializer, val bodyIndex: (IrBody) -> Int) : IrCarrierSerializer() {
@@ -97,6 +99,10 @@ internal class IrCarrierSerializerImpl(val fileSerializer: IrFileSerializer, val
return Flags.MODALITY.toFlags(ProtoEnumFlags.modality(value)).toLong()
}
override fun serializeInlineClassRepresentation(value: InlineClassRepresentation<IrSimpleType>): ProtoIrInlineClassRepresentation {
return fileSerializer.serializeInlineClassRepresentation(value)
}
override fun serializeIsExternalClass(value: Boolean): Long {
return IrFlags.IS_EXTERNAL_CLASS.toFlags(value).toLong()
}
@@ -112,4 +118,4 @@ internal class IrCarrierSerializerImpl(val fileSerializer: IrFileSerializer, val
override fun serializeIsExternalProperty(value: Boolean): Long {
return IrFlags.IS_EXTERNAL_PROPERTY.toFlags(value).toLong()
}
}
}
@@ -16,12 +16,10 @@
package org.jetbrains.kotlin.ir.declarations
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.SourceElement
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.util.transformInPlace
import org.jetbrains.kotlin.ir.util.transformIfNeeded
@@ -51,6 +49,8 @@ abstract class IrClass :
abstract var thisReceiver: IrValueParameter?
abstract var inlineClassRepresentation: InlineClassRepresentation<IrSimpleType>?
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitClass(this, data)
@@ -10,9 +10,11 @@ import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.util.DeclarationStubGenerator
import org.jetbrains.kotlin.ir.util.TypeTranslator
import org.jetbrains.kotlin.ir.util.render
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.name.Name
@@ -99,6 +101,12 @@ class IrLazyClass(
}
}
override var inlineClassRepresentation: InlineClassRepresentation<IrSimpleType>? by lazyVar(stubGenerator.lock) {
descriptor.inlineClassRepresentation?.mapUnderlyingType {
it.toIrType() as? IrSimpleType ?: error("Inline class underlying type is not a simple type: ${render()}")
}
}
override var attributeOwnerId: IrAttributeContainer = this
val classProto: ProtoBuf.Class? get() = (descriptor as? DeserializedClassDescriptor)?.classProto
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.expressions.impl.*
import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.symbols.impl.IrAnonymousInitializerSymbolImpl
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
import org.jetbrains.kotlin.ir.visitors.acceptVoid
@@ -156,6 +157,7 @@ open class DeepCopyIrTreeWithSymbols(
it.remapType()
}
thisReceiver = declaration.thisReceiver?.transform()
inlineClassRepresentation = declaration.inlineClassRepresentation?.mapUnderlyingType { it.remapType() as IrSimpleType }
declaration.transformDeclarationsTo(this)
}.copyAttributes(declaration)
@@ -507,6 +507,7 @@ message IrClass {
repeated IrTypeParameter type_parameter = 4;
repeated IrDeclaration declaration = 5;
repeated int32 super_type = 6 [packed=true];
optional IrInlineClassRepresentation inline_class_representation = 7;
}
message IrTypeAlias {
@@ -590,7 +591,12 @@ message IrStatement {
}
}
message IrInlineClassRepresentation {
required int32 underlying_property_name = 1;
required int32 underlying_property_type = 2;
}
message PirBodyCarrier {
required int32 lastModified = 1;
optional int64 containerFieldSymbol = 2;
}
}
@@ -25,7 +25,8 @@ message PirClassCarrier {
optional int64 thisReceiver = 5;
repeated int64 typeParameters = 6;
repeated int32 superTypes = 7;
optional int64 flags = 8 [default = 0];
optional IrInlineClassRepresentation inlineClassRepresentation = 8;
optional int64 flags = 9 [default = 0];
}
message PirConstructorCarrier {
@@ -11,18 +11,24 @@ import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideClassFilter
import org.jetbrains.kotlin.backend.common.serialization.encodings.*
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration.DeclaratorCase.*
import org.jetbrains.kotlin.backend.common.serialization.proto.IrType.KindCase.*
import org.jetbrains.kotlin.descriptors.InlineClassRepresentation
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.impl.IrVariableImpl
import org.jetbrains.kotlin.ir.descriptors.*
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
import org.jetbrains.kotlin.ir.expressions.IrBlockBody
import org.jetbrains.kotlin.ir.expressions.IrBody
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
import org.jetbrains.kotlin.ir.expressions.impl.IrErrorExpressionImpl
import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.symbols.impl.IrPublicSymbolBase
import org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterSymbolImpl
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.types.impl.*
import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.ir.util.IdSignature
import org.jetbrains.kotlin.ir.util.SymbolTable
import org.jetbrains.kotlin.ir.util.withScope
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.protobuf.CodedInputStream
import org.jetbrains.kotlin.protobuf.ExtensionRegistryLite
@@ -35,16 +41,17 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration as
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationBase as ProtoDeclarationBase
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDynamicType as ProtoDynamicType
import org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry as ProtoEnumEntry
import org.jetbrains.kotlin.backend.common.serialization.proto.IrErrorDeclaration as ProtoErrorDeclaration
import org.jetbrains.kotlin.backend.common.serialization.proto.IrErrorType as ProtoErrorType
import org.jetbrains.kotlin.backend.common.serialization.proto.IrExpression as ProtoExpression
import org.jetbrains.kotlin.backend.common.serialization.proto.IrField as ProtoField
import org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction as ProtoFunction
import org.jetbrains.kotlin.backend.common.serialization.proto.IrFunctionBase as ProtoFunctionBase
import org.jetbrains.kotlin.backend.common.serialization.proto.IrErrorDeclaration as ProtoErrorDeclaration
import org.jetbrains.kotlin.backend.common.serialization.proto.IrExpression as ProtoExpression
import org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement as ProtoStatement
import org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation as ProtoIrInlineClassRepresentation
import org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty as ProtoLocalDelegatedProperty
import org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty as ProtoProperty
import org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType as ProtoSimpleType
import org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement as ProtoStatement
import org.jetbrains.kotlin.backend.common.serialization.proto.IrType as ProtoType
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation as ProtoTypeAbbreviation
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias as ProtoTypeAlias
@@ -319,11 +326,21 @@ class IrDeclarationDeserializer(
thisReceiver = deserializeIrValueParameter(proto.thisReceiver, -1)
inlineClassRepresentation =
if (proto.hasInlineClassRepresentation()) deserializeInlineClassRepresentation(proto.inlineClassRepresentation)
else null
fakeOverrideBuilder.enqueueClass(this, signature)
}
}
}
fun deserializeInlineClassRepresentation(proto: ProtoIrInlineClassRepresentation): InlineClassRepresentation<IrSimpleType> =
InlineClassRepresentation(
deserializeName(proto.underlyingPropertyName),
deserializeIrType(proto.underlyingPropertyType) as IrSimpleType,
)
private fun deserializeIrTypeAlias(proto: ProtoTypeAlias): IrTypeAlias =
withDeserializedIrDeclarationBase(proto.base) { symbol, uniqId, startOffset, endOffset, origin, fcode ->
require(symbol is IrTypeAliasSymbol)
@@ -721,4 +738,4 @@ class IrDeclarationDeserializer(
else -> false
}
}
}
}
@@ -8,8 +8,8 @@ package org.jetbrains.kotlin.backend.common.serialization
import org.jetbrains.kotlin.backend.common.ir.ir2string
import org.jetbrains.kotlin.backend.common.serialization.encodings.*
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.ir.IrFileEntry
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.IrFileEntry
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.symbols.*
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.library.impl.IrMemoryDeclarationWriter
import org.jetbrains.kotlin.library.impl.IrMemoryStringWriter
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature as ProtoAccessorIdSignature
import org.jetbrains.kotlin.backend.common.serialization.proto.Actual as ProtoActual
import org.jetbrains.kotlin.backend.common.serialization.proto.FieldAccessCommon as ProtoFieldAccessCommon
import org.jetbrains.kotlin.backend.common.serialization.proto.FileEntry as ProtoFileEntry
@@ -52,9 +53,9 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.IrDynamicOperator
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDynamicType as ProtoDynamicType
import org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumConstructorCall as ProtoEnumConstructorCall
import org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry as ProtoEnumEntry
import org.jetbrains.kotlin.backend.common.serialization.proto.IrErrorCallExpression as ProtoErrorCallExpression
import org.jetbrains.kotlin.backend.common.serialization.proto.IrErrorDeclaration as ProtoErrorDeclaration
import org.jetbrains.kotlin.backend.common.serialization.proto.IrErrorExpression as ProtoErrorExpression
import org.jetbrains.kotlin.backend.common.serialization.proto.IrErrorCallExpression as ProtoErrorCallExpression
import org.jetbrains.kotlin.backend.common.serialization.proto.IrErrorType as ProtoErrorType
import org.jetbrains.kotlin.backend.common.serialization.proto.IrExpression as ProtoExpression
import org.jetbrains.kotlin.backend.common.serialization.proto.IrField as ProtoField
@@ -68,6 +69,7 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.IrGetEnumValue as
import org.jetbrains.kotlin.backend.common.serialization.proto.IrGetField as ProtoGetField
import org.jetbrains.kotlin.backend.common.serialization.proto.IrGetObject as ProtoGetObject
import org.jetbrains.kotlin.backend.common.serialization.proto.IrGetValue as ProtoGetValue
import org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation as ProtoIrInlineClassRepresentation
import org.jetbrains.kotlin.backend.common.serialization.proto.IrInstanceInitializerCall as ProtoInstanceInitializerCall
import org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty as ProtoLocalDelegatedProperty
import org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedPropertyReference as ProtoLocalDelegatedPropertyReference
@@ -101,7 +103,6 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.Loop as ProtoLoop
import org.jetbrains.kotlin.backend.common.serialization.proto.MemberAccessCommon as ProtoMemberAccessCommon
import org.jetbrains.kotlin.backend.common.serialization.proto.NullableIrExpression as ProtoNullableIrExpression
import org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature as ProtoPublicIdSignature
import org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature as ProtoAccessorIdSignature
open class IrFileSerializer(
val messageLogger: IrMessageLogger,
@@ -1149,6 +1150,11 @@ open class IrFileSerializer(
.setBase(serializeIrDeclarationBase(clazz, ClassFlags.encode(clazz)))
.setName(serializeName(clazz.name))
val representation = clazz.inlineClassRepresentation
if (representation != null) {
proto.inlineClassRepresentation = serializeInlineClassRepresentation(representation)
}
if (!skipMutableState) {
clazz.declarations.forEach {
if (memberNeedsSerialization(it)) proto.addDeclaration(serializeDeclaration(it))
@@ -1168,6 +1174,13 @@ open class IrFileSerializer(
return proto.build()
}
fun serializeInlineClassRepresentation(representation: InlineClassRepresentation<IrSimpleType>): ProtoIrInlineClassRepresentation =
ProtoIrInlineClassRepresentation.newBuilder().apply {
underlyingPropertyName = serializeName(representation.underlyingPropertyName)
// TODO: consider not writing type if the property is public, similarly to metadata
underlyingPropertyType = serializeIrType(representation.underlyingType)
}.build()
private fun serializeIrTypeAlias(typeAlias: IrTypeAlias): ProtoTypeAlias {
val proto = ProtoTypeAlias.newBuilder()
@@ -1400,4 +1413,3 @@ open class IrFileSerializer(
}
}
}
@@ -121,6 +121,19 @@ public final class IrClass extends
input.popLimit(limit);
break;
}
case 58: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.Builder subBuilder = null;
if (((bitField0_ & 0x00000008) == 0x00000008)) {
subBuilder = inlineClassRepresentation_.toBuilder();
}
inlineClassRepresentation_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(inlineClassRepresentation_);
inlineClassRepresentation_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000008;
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
@@ -302,6 +315,21 @@ public final class IrClass extends
}
private int superTypeMemoizedSerializedSize = -1;
public static final int INLINE_CLASS_REPRESENTATION_FIELD_NUMBER = 7;
private org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation_;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inline_class_representation = 7;</code>
*/
public boolean hasInlineClassRepresentation() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inline_class_representation = 7;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation getInlineClassRepresentation() {
return inlineClassRepresentation_;
}
private void initFields() {
base_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationBase.getDefaultInstance();
name_ = 0;
@@ -309,6 +337,7 @@ public final class IrClass extends
typeParameter_ = java.util.Collections.emptyList();
declaration_ = java.util.Collections.emptyList();
superType_ = java.util.Collections.emptyList();
inlineClassRepresentation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -346,6 +375,12 @@ public final class IrClass extends
return false;
}
}
if (hasInlineClassRepresentation()) {
if (!getInlineClassRepresentation().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
@@ -375,6 +410,9 @@ public final class IrClass extends
for (int i = 0; i < superType_.size(); i++) {
output.writeInt32NoTag(superType_.get(i));
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeMessage(7, inlineClassRepresentation_);
}
output.writeRawBytes(unknownFields);
}
@@ -418,6 +456,10 @@ public final class IrClass extends
}
superTypeMemoizedSerializedSize = dataSize;
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(7, inlineClassRepresentation_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
return size;
@@ -524,6 +566,8 @@ public final class IrClass extends
bitField0_ = (bitField0_ & ~0x00000010);
superType_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000020);
inlineClassRepresentation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000040);
return this;
}
@@ -574,6 +618,10 @@ public final class IrClass extends
bitField0_ = (bitField0_ & ~0x00000020);
}
result.superType_ = superType_;
if (((from_bitField0_ & 0x00000040) == 0x00000040)) {
to_bitField0_ |= 0x00000008;
}
result.inlineClassRepresentation_ = inlineClassRepresentation_;
result.bitField0_ = to_bitField0_;
return result;
}
@@ -619,6 +667,9 @@ public final class IrClass extends
}
}
if (other.hasInlineClassRepresentation()) {
mergeInlineClassRepresentation(other.getInlineClassRepresentation());
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
return this;
@@ -655,6 +706,12 @@ public final class IrClass extends
return false;
}
}
if (hasInlineClassRepresentation()) {
if (!getInlineClassRepresentation().isInitialized()) {
return false;
}
}
return true;
}
@@ -1145,6 +1202,66 @@ public final class IrClass extends
return this;
}
private org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inline_class_representation = 7;</code>
*/
public boolean hasInlineClassRepresentation() {
return ((bitField0_ & 0x00000040) == 0x00000040);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inline_class_representation = 7;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation getInlineClassRepresentation() {
return inlineClassRepresentation_;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inline_class_representation = 7;</code>
*/
public Builder setInlineClassRepresentation(org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation value) {
if (value == null) {
throw new NullPointerException();
}
inlineClassRepresentation_ = value;
bitField0_ |= 0x00000040;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inline_class_representation = 7;</code>
*/
public Builder setInlineClassRepresentation(
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.Builder builderForValue) {
inlineClassRepresentation_ = builderForValue.build();
bitField0_ |= 0x00000040;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inline_class_representation = 7;</code>
*/
public Builder mergeInlineClassRepresentation(org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation value) {
if (((bitField0_ & 0x00000040) == 0x00000040) &&
inlineClassRepresentation_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance()) {
inlineClassRepresentation_ =
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.newBuilder(inlineClassRepresentation_).mergeFrom(value).buildPartial();
} else {
inlineClassRepresentation_ = value;
}
bitField0_ |= 0x00000040;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inline_class_representation = 7;</code>
*/
public Builder clearInlineClassRepresentation() {
inlineClassRepresentation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000040);
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrClass)
}
@@ -74,4 +74,13 @@ public interface IrClassOrBuilder extends
* <code>repeated int32 super_type = 6 [packed = true];</code>
*/
int getSuperType(int index);
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inline_class_representation = 7;</code>
*/
boolean hasInlineClassRepresentation();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inline_class_representation = 7;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation getInlineClassRepresentation();
}
@@ -0,0 +1,428 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation}
*/
public final class IrInlineClassRepresentation extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite implements
// @@protoc_insertion_point(message_implements:org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation)
IrInlineClassRepresentationOrBuilder {
// Use IrInlineClassRepresentation.newBuilder() to construct.
private IrInlineClassRepresentation(org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private IrInlineClassRepresentation(boolean noInit) { this.unknownFields = org.jetbrains.kotlin.protobuf.ByteString.EMPTY;}
private static final IrInlineClassRepresentation defaultInstance;
public static IrInlineClassRepresentation getDefaultInstance() {
return defaultInstance;
}
public IrInlineClassRepresentation getDefaultInstanceForType() {
return defaultInstance;
}
private final org.jetbrains.kotlin.protobuf.ByteString unknownFields;
private IrInlineClassRepresentation(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
org.jetbrains.kotlin.protobuf.ByteString.Output unknownFieldsOutput =
org.jetbrains.kotlin.protobuf.ByteString.newOutput();
org.jetbrains.kotlin.protobuf.CodedOutputStream unknownFieldsCodedOutput =
org.jetbrains.kotlin.protobuf.CodedOutputStream.newInstance(
unknownFieldsOutput, 1);
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFieldsCodedOutput,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 8: {
bitField0_ |= 0x00000001;
underlyingPropertyName_ = input.readInt32();
break;
}
case 16: {
bitField0_ |= 0x00000002;
underlyingPropertyType_ = input.readInt32();
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
try {
unknownFieldsCodedOutput.flush();
} catch (java.io.IOException e) {
// Should not happen
} finally {
unknownFields = unknownFieldsOutput.toByteString();
}
makeExtensionsImmutable();
}
}
public static org.jetbrains.kotlin.protobuf.Parser<IrInlineClassRepresentation> PARSER =
new org.jetbrains.kotlin.protobuf.AbstractParser<IrInlineClassRepresentation>() {
public IrInlineClassRepresentation parsePartialFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return new IrInlineClassRepresentation(input, extensionRegistry);
}
};
@java.lang.Override
public org.jetbrains.kotlin.protobuf.Parser<IrInlineClassRepresentation> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int UNDERLYING_PROPERTY_NAME_FIELD_NUMBER = 1;
private int underlyingPropertyName_;
/**
* <code>required int32 underlying_property_name = 1;</code>
*/
public boolean hasUnderlyingPropertyName() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 underlying_property_name = 1;</code>
*/
public int getUnderlyingPropertyName() {
return underlyingPropertyName_;
}
public static final int UNDERLYING_PROPERTY_TYPE_FIELD_NUMBER = 2;
private int underlyingPropertyType_;
/**
* <code>required int32 underlying_property_type = 2;</code>
*/
public boolean hasUnderlyingPropertyType() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int32 underlying_property_type = 2;</code>
*/
public int getUnderlyingPropertyType() {
return underlyingPropertyType_;
}
private void initFields() {
underlyingPropertyName_ = 0;
underlyingPropertyType_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasUnderlyingPropertyName()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasUnderlyingPropertyType()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(org.jetbrains.kotlin.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeInt32(1, underlyingPropertyName_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeInt32(2, underlyingPropertyType_);
}
output.writeRawBytes(unknownFields);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(1, underlyingPropertyName_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(2, underlyingPropertyType_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation parseFrom(byte[] data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation parseFrom(
byte[] data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation parseFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation parseDelimitedFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation}
*/
public static final class Builder extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder<
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation, Builder>
implements
// @@protoc_insertion_point(builder_implements:org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation)
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentationOrBuilder {
// Construct using org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
underlyingPropertyName_ = 0;
bitField0_ = (bitField0_ & ~0x00000001);
underlyingPropertyType_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation getDefaultInstanceForType() {
return org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance();
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation build() {
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation buildPartial() {
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation result = new org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.underlyingPropertyName_ = underlyingPropertyName_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.underlyingPropertyType_ = underlyingPropertyType_;
result.bitField0_ = to_bitField0_;
return result;
}
public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation other) {
if (other == org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance()) return this;
if (other.hasUnderlyingPropertyName()) {
setUnderlyingPropertyName(other.getUnderlyingPropertyName());
}
if (other.hasUnderlyingPropertyType()) {
setUnderlyingPropertyType(other.getUnderlyingPropertyType());
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
return this;
}
public final boolean isInitialized() {
if (!hasUnderlyingPropertyName()) {
return false;
}
if (!hasUnderlyingPropertyType()) {
return false;
}
return true;
}
public Builder mergeFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private int underlyingPropertyName_ ;
/**
* <code>required int32 underlying_property_name = 1;</code>
*/
public boolean hasUnderlyingPropertyName() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 underlying_property_name = 1;</code>
*/
public int getUnderlyingPropertyName() {
return underlyingPropertyName_;
}
/**
* <code>required int32 underlying_property_name = 1;</code>
*/
public Builder setUnderlyingPropertyName(int value) {
bitField0_ |= 0x00000001;
underlyingPropertyName_ = value;
return this;
}
/**
* <code>required int32 underlying_property_name = 1;</code>
*/
public Builder clearUnderlyingPropertyName() {
bitField0_ = (bitField0_ & ~0x00000001);
underlyingPropertyName_ = 0;
return this;
}
private int underlyingPropertyType_ ;
/**
* <code>required int32 underlying_property_type = 2;</code>
*/
public boolean hasUnderlyingPropertyType() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int32 underlying_property_type = 2;</code>
*/
public int getUnderlyingPropertyType() {
return underlyingPropertyType_;
}
/**
* <code>required int32 underlying_property_type = 2;</code>
*/
public Builder setUnderlyingPropertyType(int value) {
bitField0_ |= 0x00000002;
underlyingPropertyType_ = value;
return this;
}
/**
* <code>required int32 underlying_property_type = 2;</code>
*/
public Builder clearUnderlyingPropertyType() {
bitField0_ = (bitField0_ & ~0x00000002);
underlyingPropertyType_ = 0;
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation)
}
static {
defaultInstance = new IrInlineClassRepresentation(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation)
}
@@ -0,0 +1,27 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
public interface IrInlineClassRepresentationOrBuilder extends
// @@protoc_insertion_point(interface_extends:org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation)
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>required int32 underlying_property_name = 1;</code>
*/
boolean hasUnderlyingPropertyName();
/**
* <code>required int32 underlying_property_name = 1;</code>
*/
int getUnderlyingPropertyName();
/**
* <code>required int32 underlying_property_type = 2;</code>
*/
boolean hasUnderlyingPropertyType();
/**
* <code>required int32 underlying_property_type = 2;</code>
*/
int getUnderlyingPropertyType();
}
@@ -123,8 +123,21 @@ public final class PirClassCarrier extends
input.popLimit(limit);
break;
}
case 64: {
case 66: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.Builder subBuilder = null;
if (((bitField0_ & 0x00000010) == 0x00000010)) {
subBuilder = inlineClassRepresentation_.toBuilder();
}
inlineClassRepresentation_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(inlineClassRepresentation_);
inlineClassRepresentation_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000010;
break;
}
case 72: {
bitField0_ |= 0x00000020;
flags_ = input.readInt64();
break;
}
@@ -310,16 +323,31 @@ public final class PirClassCarrier extends
return superTypes_.get(index);
}
public static final int FLAGS_FIELD_NUMBER = 8;
private long flags_;
public static final int INLINECLASSREPRESENTATION_FIELD_NUMBER = 8;
private org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation_;
/**
* <code>optional int64 flags = 8 [default = 0];</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation = 8;</code>
*/
public boolean hasFlags() {
public boolean hasInlineClassRepresentation() {
return ((bitField0_ & 0x00000010) == 0x00000010);
}
/**
* <code>optional int64 flags = 8 [default = 0];</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation = 8;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation getInlineClassRepresentation() {
return inlineClassRepresentation_;
}
public static final int FLAGS_FIELD_NUMBER = 9;
private long flags_;
/**
* <code>optional int64 flags = 9 [default = 0];</code>
*/
public boolean hasFlags() {
return ((bitField0_ & 0x00000020) == 0x00000020);
}
/**
* <code>optional int64 flags = 9 [default = 0];</code>
*/
public long getFlags() {
return flags_;
@@ -333,6 +361,7 @@ public final class PirClassCarrier extends
thisReceiver_ = 0L;
typeParameters_ = java.util.Collections.emptyList();
superTypes_ = java.util.Collections.emptyList();
inlineClassRepresentation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance();
flags_ = 0L;
}
private byte memoizedIsInitialized = -1;
@@ -351,6 +380,12 @@ public final class PirClassCarrier extends
return false;
}
}
if (hasInlineClassRepresentation()) {
if (!getInlineClassRepresentation().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
@@ -380,7 +415,10 @@ public final class PirClassCarrier extends
output.writeInt32(7, superTypes_.get(i));
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
output.writeInt64(8, flags_);
output.writeMessage(8, inlineClassRepresentation_);
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
output.writeInt64(9, flags_);
}
output.writeRawBytes(unknownFields);
}
@@ -431,7 +469,11 @@ public final class PirClassCarrier extends
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt64Size(8, flags_);
.computeMessageSize(8, inlineClassRepresentation_);
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt64Size(9, flags_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
@@ -541,8 +583,10 @@ public final class PirClassCarrier extends
bitField0_ = (bitField0_ & ~0x00000020);
superTypes_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000040);
flags_ = 0L;
inlineClassRepresentation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000080);
flags_ = 0L;
bitField0_ = (bitField0_ & ~0x00000100);
return this;
}
@@ -600,6 +644,10 @@ public final class PirClassCarrier extends
if (((from_bitField0_ & 0x00000080) == 0x00000080)) {
to_bitField0_ |= 0x00000010;
}
result.inlineClassRepresentation_ = inlineClassRepresentation_;
if (((from_bitField0_ & 0x00000100) == 0x00000100)) {
to_bitField0_ |= 0x00000020;
}
result.flags_ = flags_;
result.bitField0_ = to_bitField0_;
return result;
@@ -649,6 +697,9 @@ public final class PirClassCarrier extends
}
}
if (other.hasInlineClassRepresentation()) {
mergeInlineClassRepresentation(other.getInlineClassRepresentation());
}
if (other.hasFlags()) {
setFlags(other.getFlags());
}
@@ -668,6 +719,12 @@ public final class PirClassCarrier extends
return false;
}
}
if (hasInlineClassRepresentation()) {
if (!getInlineClassRepresentation().isInitialized()) {
return false;
}
}
return true;
}
@@ -1075,33 +1132,93 @@ public final class PirClassCarrier extends
return this;
}
private long flags_ ;
private org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance();
/**
* <code>optional int64 flags = 8 [default = 0];</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation = 8;</code>
*/
public boolean hasFlags() {
public boolean hasInlineClassRepresentation() {
return ((bitField0_ & 0x00000080) == 0x00000080);
}
/**
* <code>optional int64 flags = 8 [default = 0];</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation = 8;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation getInlineClassRepresentation() {
return inlineClassRepresentation_;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation = 8;</code>
*/
public Builder setInlineClassRepresentation(org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation value) {
if (value == null) {
throw new NullPointerException();
}
inlineClassRepresentation_ = value;
bitField0_ |= 0x00000080;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation = 8;</code>
*/
public Builder setInlineClassRepresentation(
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.Builder builderForValue) {
inlineClassRepresentation_ = builderForValue.build();
bitField0_ |= 0x00000080;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation = 8;</code>
*/
public Builder mergeInlineClassRepresentation(org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation value) {
if (((bitField0_ & 0x00000080) == 0x00000080) &&
inlineClassRepresentation_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance()) {
inlineClassRepresentation_ =
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.newBuilder(inlineClassRepresentation_).mergeFrom(value).buildPartial();
} else {
inlineClassRepresentation_ = value;
}
bitField0_ |= 0x00000080;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation = 8;</code>
*/
public Builder clearInlineClassRepresentation() {
inlineClassRepresentation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000080);
return this;
}
private long flags_ ;
/**
* <code>optional int64 flags = 9 [default = 0];</code>
*/
public boolean hasFlags() {
return ((bitField0_ & 0x00000100) == 0x00000100);
}
/**
* <code>optional int64 flags = 9 [default = 0];</code>
*/
public long getFlags() {
return flags_;
}
/**
* <code>optional int64 flags = 8 [default = 0];</code>
* <code>optional int64 flags = 9 [default = 0];</code>
*/
public Builder setFlags(long value) {
bitField0_ |= 0x00000080;
bitField0_ |= 0x00000100;
flags_ = value;
return this;
}
/**
* <code>optional int64 flags = 8 [default = 0];</code>
* <code>optional int64 flags = 9 [default = 0];</code>
*/
public Builder clearFlags() {
bitField0_ = (bitField0_ & ~0x00000080);
bitField0_ = (bitField0_ & ~0x00000100);
flags_ = 0L;
return this;
@@ -84,11 +84,20 @@ public interface PirClassCarrierOrBuilder extends
int getSuperTypes(int index);
/**
* <code>optional int64 flags = 8 [default = 0];</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation = 8;</code>
*/
boolean hasInlineClassRepresentation();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation = 8;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation getInlineClassRepresentation();
/**
* <code>optional int64 flags = 9 [default = 0];</code>
*/
boolean hasFlags();
/**
* <code>optional int64 flags = 8 [default = 0];</code>
* <code>optional int64 flags = 9 [default = 0];</code>
*/
long getFlags();
}
@@ -0,0 +1,27 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
public interface PirInlineClassRepresentationOrBuilder extends
// @@protoc_insertion_point(interface_extends:org.jetbrains.kotlin.backend.common.serialization.proto.PirInlineClassRepresentation)
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>required int32 underlying_property_name = 1;</code>
*/
boolean hasUnderlyingPropertyName();
/**
* <code>required int32 underlying_property_name = 1;</code>
*/
int getUnderlyingPropertyName();
/**
* <code>required int32 underlying_property_type = 2;</code>
*/
boolean hasUnderlyingPropertyType();
/**
* <code>required int32 underlying_property_type = 2;</code>
*/
int getUnderlyingPropertyType();
}
@@ -11,4 +11,7 @@ import org.jetbrains.kotlin.types.model.SimpleTypeMarker
class InlineClassRepresentation<Type : SimpleTypeMarker>(
val underlyingPropertyName: Name,
val underlyingType: Type,
)
) {
inline fun <Other : SimpleTypeMarker> mapUnderlyingType(transform: (Type) -> Other): InlineClassRepresentation<Other> =
InlineClassRepresentation(underlyingPropertyName, transform(underlyingType))
}