diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/NodeConfigurator.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/NodeConfigurator.kt index 1c3a97c0f5f..c2b1f8e920d 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/NodeConfigurator.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/NodeConfigurator.kt @@ -289,7 +289,9 @@ object NodeConfigurator : AbstractFieldConfigurator(FirTreeBuild typeParameter.configure { +name +symbol("FirTypeParameterSymbol") - +field("containingDeclarationSymbol", firBasedSymbolType, "*", nullable = true) + +field("containingDeclarationSymbol", firBasedSymbolType, "*", nullable = true).apply { + withBindThis = false + } +field(varianceType) +booleanField("isReified") +fieldList("bounds", typeRef, withReplace = true) diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/model/Field.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/model/Field.kt index ddaee6f454c..2b5d3ac5f6b 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/model/Field.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/model/Field.kt @@ -28,6 +28,8 @@ sealed class Field : Importable { open val overridenTypes: MutableSet = mutableSetOf() open var useNullableForReplace: Boolean = false + var withBindThis = true + fun copy(): Field = internalCopy().also { updateFieldsInCopy(it) } @@ -137,7 +139,9 @@ class SimpleField( customType, nullable, withReplace - ) + ).apply { + withBindThis = this@SimpleField.withBindThis + } } fun replaceType(newType: Type) = SimpleField( @@ -148,6 +152,7 @@ class SimpleField( nullable, withReplace ).also { + it.withBindThis = withBindThis updateFieldsInCopy(it) } } @@ -176,7 +181,9 @@ class FirField( element, nullable, withReplace - ) + ).apply { + withBindThis = this@FirField.withBindThis + } } } diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/printer/implementation.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/printer/implementation.kt index 090d9bcc9ff..20041763457 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/printer/implementation.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/printer/implementation.kt @@ -103,7 +103,7 @@ fun SmartPrinter.printImplementation(implementation: Implementation) { element.allFields.filter { - it.name != "containingDeclarationSymbol" && it.type.contains("Symbol") && it !is FieldList + it.withBindThis && it.type.contains("Symbol") && it !is FieldList }.takeIf { it.isNotEmpty() && !isInterface && !isAbstract && !element.type.contains("Reference")