diff --git a/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/model/Field.kt b/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/model/Field.kt index ceff9e830bd..06d7540c335 100644 --- a/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/model/Field.kt +++ b/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/model/Field.kt @@ -32,7 +32,6 @@ sealed class Field( override var withGetter: Boolean = false - override var defaultValueInBase: String? = null override var defaultValueInImplementation: String? = null override var defaultValueInBuilder: String? get() = null @@ -58,7 +57,6 @@ sealed class Field( override fun updateFieldsInCopy(copy: Field) { super.updateFieldsInCopy(copy) copy.withGetter = withGetter - copy.defaultValueInBase = defaultValueInBase copy.defaultValueInImplementation = defaultValueInImplementation copy.customUseInIrFactoryStrategy = customUseInIrFactoryStrategy copy.customSetter = customSetter diff --git a/generators/tree-generator-common/src/org/jetbrains/kotlin/generators/tree/AbstractElementPrinter.kt b/generators/tree-generator-common/src/org/jetbrains/kotlin/generators/tree/AbstractElementPrinter.kt index 2b1c7a4e982..6321b9b8e7d 100644 --- a/generators/tree-generator-common/src/org/jetbrains/kotlin/generators/tree/AbstractElementPrinter.kt +++ b/generators/tree-generator-common/src/org/jetbrains/kotlin/generators/tree/AbstractElementPrinter.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2024 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. */ @@ -52,7 +52,7 @@ abstract class AbstractElementPrinter> { open val containsElement: Boolean get() = typeRef is ElementOrRef<*> || this is ListField && baseType is ElementOrRef<*> - open val defaultValueInBase: String? get() = null open val defaultValueInImplementation: String? get() = null /** diff --git a/generators/tree-generator-common/src/org/jetbrains/kotlin/generators/tree/AbstractFieldPrinter.kt b/generators/tree-generator-common/src/org/jetbrains/kotlin/generators/tree/AbstractFieldPrinter.kt index 89a1dedbe55..83aec4ef3be 100644 --- a/generators/tree-generator-common/src/org/jetbrains/kotlin/generators/tree/AbstractFieldPrinter.kt +++ b/generators/tree-generator-common/src/org/jetbrains/kotlin/generators/tree/AbstractFieldPrinter.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2024 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. */ @@ -42,7 +42,7 @@ abstract class AbstractFieldPrinter>( modality: Modality? = null, ) { printer.run { - val defaultValue = if (inImplementation) field.defaultValueInImplementation else field.defaultValueInBase + val defaultValue = if (inImplementation) field.defaultValueInImplementation else null printPropertyDeclaration( name = field.name, type = actualTypeOfField(field), diff --git a/generators/tree-generator-common/src/org/jetbrains/kotlin/generators/tree/AbstractImplementation.kt b/generators/tree-generator-common/src/org/jetbrains/kotlin/generators/tree/AbstractImplementation.kt index f7fe1837e8e..5cc65432883 100644 --- a/generators/tree-generator-common/src/org/jetbrains/kotlin/generators/tree/AbstractImplementation.kt +++ b/generators/tree-generator-common/src/org/jetbrains/kotlin/generators/tree/AbstractImplementation.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2024 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. */ @@ -73,11 +73,11 @@ abstract class AbstractImplementation( } private fun withDefault(field: Field) = - !field.isFinal && (field.defaultValueInImplementation != null || field.defaultValueInBase != null || field.isLateinit) + !field.isFinal && (field.defaultValueInImplementation != null || field.isLateinit) val fieldsInConstructor by lazy { allFields.filterNot(::withDefault) } - val fieldsInBody by lazy { allFields.filter(::withDefault).filter { it.defaultValueInBase == null } } + val fieldsInBody by lazy { allFields.filter(::withDefault) } var requiresOptIn = false