diff --git a/compiler/ir/ir.tree/gen/org/jetbrains/kotlin/ir/declarations/IrAttributeContainer.kt b/compiler/ir/ir.tree/gen/org/jetbrains/kotlin/ir/declarations/IrAttributeContainer.kt index 294c8c81a9d..3941cc7fe6d 100644 --- a/compiler/ir/ir.tree/gen/org/jetbrains/kotlin/ir/declarations/IrAttributeContainer.kt +++ b/compiler/ir/ir.tree/gen/org/jetbrains/kotlin/ir/declarations/IrAttributeContainer.kt @@ -14,9 +14,9 @@ import org.jetbrains.kotlin.ir.IrElement * Represents an IR element that can be copied, but must remember its original element. It is * useful, for example, to keep track of generated names for anonymous declarations. * @property attributeOwnerId original element before copying. Always satisfies the following - * invariant: this.attributeOwnerId == this.attributeOwnerId.attributeOwnerId. + * invariant: `this.attributeOwnerId == this.attributeOwnerId.attributeOwnerId`. * @property originalBeforeInline original element before inlining. Useful only with IR - * inliner. null if the element wasn't inlined. Unlike [attributeOwnerId], doesn't have the + * inliner. `null` if the element wasn't inlined. Unlike [attributeOwnerId], doesn't have the * idempotence invariant and can contain a chain of declarations. * @sample org.jetbrains.kotlin.ir.generator.IrTree.attributeContainer */ diff --git a/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/print/Common.kt b/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/print/Common.kt index 4b523b3b501..084a5104705 100644 --- a/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/print/Common.kt +++ b/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/print/Common.kt @@ -23,7 +23,7 @@ fun printTypeCommon(generationPath: File, packageName: String, type: TypeSpec): .addType(type) .build() .toString() - .replace("`", "") + .unbacktickIdentifiers("data", "value", "operator", "constructor", "delegate", "receiver", "field") .replace("public ", "") .replace(":\\s*Unit".toRegex(), "") .replace("import kotlin\\..*\\n".toRegex(), "") @@ -35,6 +35,14 @@ fun printTypeCommon(generationPath: File, packageName: String, type: TypeSpec): return GeneratedFile(getPathForFile(generationPath, packageName, type.name!!), text) } +private fun String.unbacktickIdentifiers(vararg identifiers: String): String { + var result = this + for (identifier in identifiers) { + result = result.replace("`$identifier`", identifier) + } + return result +} + fun getPathForFile(generationPath: File, packageName: String, typeName: String): File { val dir = generationPath.resolve(packageName.replace(".", "/")) return File(dir, "$typeName.kt")