[IR] Autogenerate IrConstImpl #KT-65773 Fixed
diff --git a/compiler/ir/ir.tree/gen/org/jetbrains/kotlin/ir/expressions/impl/IrConstImpl.kt b/compiler/ir/ir.tree/gen/org/jetbrains/kotlin/ir/expressions/impl/IrConstImpl.kt index 056ce78..f2f1f46 100644 --- a/compiler/ir/ir.tree/gen/org/jetbrains/kotlin/ir/expressions/impl/IrConstImpl.kt +++ b/compiler/ir/ir.tree/gen/org/jetbrains/kotlin/ir/expressions/impl/IrConstImpl.kt
@@ -3,21 +3,21 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ +// This file was generated automatically. See compiler/ir/ir.tree/tree-generator/ReadMe.md. +// DO NOT MODIFY IT MANUALLY. + +@file:Suppress("DuplicatedCode") + package org.jetbrains.kotlin.ir.expressions.impl -import org.jetbrains.kotlin.builtins.PrimitiveType import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer import org.jetbrains.kotlin.ir.expressions.IrConst import org.jetbrains.kotlin.ir.expressions.IrConstKind import org.jetbrains.kotlin.ir.types.IrType -import org.jetbrains.kotlin.ir.types.getPrimitiveType -import org.jetbrains.kotlin.ir.types.isMarkedNullable -import org.jetbrains.kotlin.ir.types.makeNullable import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator class IrConstImpl<T> internal constructor( - @Suppress("UNUSED_PARAMETER") - constructorIndicator: IrElementConstructorIndicator?, + @Suppress("UNUSED_PARAMETER") constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, @@ -25,6 +25,7 @@ override var value: T, ) : IrConst<T>() { override var attributeOwnerId: IrAttributeContainer = this + override var originalBeforeInline: IrAttributeContainer? = null companion object {
diff --git a/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/ImplementationConfigurator.kt b/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/ImplementationConfigurator.kt index 672129f..77703cb 100644 --- a/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/ImplementationConfigurator.kt +++ b/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/ImplementationConfigurator.kt
@@ -310,6 +310,51 @@ } } + impl(const) { + implementation.generationCallback = { + println() + printlnMultiLine(""" + companion object { + fun string(startOffset: Int, endOffset: Int, type: IrType, value: String): IrConstImpl<String> = + IrConstImpl(startOffset, endOffset, type, IrConstKind.String, value) + + fun int(startOffset: Int, endOffset: Int, type: IrType, value: Int): IrConstImpl<Int> = + IrConstImpl(startOffset, endOffset, type, IrConstKind.Int, value) + + fun constNull(startOffset: Int, endOffset: Int, type: IrType): IrConstImpl<Nothing?> = + IrConstImpl(startOffset, endOffset, type, IrConstKind.Null, null) + + fun boolean(startOffset: Int, endOffset: Int, type: IrType, value: Boolean): IrConstImpl<Boolean> = + IrConstImpl(startOffset, endOffset, type, IrConstKind.Boolean, value) + + fun constTrue(startOffset: Int, endOffset: Int, type: IrType): IrConstImpl<Boolean> = + boolean(startOffset, endOffset, type, true) + + fun constFalse(startOffset: Int, endOffset: Int, type: IrType): IrConstImpl<Boolean> = + boolean(startOffset, endOffset, type, false) + + fun long(startOffset: Int, endOffset: Int, type: IrType, value: Long): IrConstImpl<Long> = + IrConstImpl(startOffset, endOffset, type, IrConstKind.Long, value) + + fun float(startOffset: Int, endOffset: Int, type: IrType, value: Float): IrConstImpl<Float> = + IrConstImpl(startOffset, endOffset, type, IrConstKind.Float, value) + + fun double(startOffset: Int, endOffset: Int, type: IrType, value: Double): IrConstImpl<Double> = + IrConstImpl(startOffset, endOffset, type, IrConstKind.Double, value) + + fun char(startOffset: Int, endOffset: Int, type: IrType, value: Char): IrConstImpl<Char> = + IrConstImpl(startOffset, endOffset, type, IrConstKind.Char, value) + + fun byte(startOffset: Int, endOffset: Int, type: IrType, value: Byte): IrConstImpl<Byte> = + IrConstImpl(startOffset, endOffset, type, IrConstKind.Byte, value) + + fun short(startOffset: Int, endOffset: Int, type: IrType, value: Short): IrConstImpl<Short> = + IrConstImpl(startOffset, endOffset, type, IrConstKind.Short, value) + } + """.trimIndent()) + } + } + allImplOf(memberAccessExpression) { defaultNull("dispatchReceiver", "extensionReceiver") } @@ -407,11 +452,6 @@ for (element in model.elements) { for (implementation in element.implementations) { - // Generation of implementation classes of IrMemberAccessExpression are left out for subsequent MR, as a part of KT-65773. - if (element == IrTree.const) { - implementation.doPrint = false - } - if (element.category == Element.Category.Expression) { implementation.isConstructorPublic = false }
diff --git a/generators/tree-generator-common/src/org/jetbrains/kotlin/generators/tree/AbstractImplementationPrinter.kt b/generators/tree-generator-common/src/org/jetbrains/kotlin/generators/tree/AbstractImplementationPrinter.kt index 0b77f2d..1403b1f 100644 --- a/generators/tree-generator-common/src/org/jetbrains/kotlin/generators/tree/AbstractImplementationPrinter.kt +++ b/generators/tree-generator-common/src/org/jetbrains/kotlin/generators/tree/AbstractImplementationPrinter.kt
@@ -60,7 +60,7 @@ val kind = implementation.kind ?: error("Expected non-null element kind") print("${kind.title} ${implementation.typeName}") - print(implementation.element.params.typeParameters(end = " ")) + print(implementation.element.params.typeParameters()) val isInterface = kind == ImplementationKind.Interface || kind == ImplementationKind.SealedInterface val isAbstract = kind == ImplementationKind.AbstractClass || kind == ImplementationKind.SealedClass