From e9fbeb9be29e3e0e6e44780b20fad5c929613ff5 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 15 Dec 2022 12:07:10 +0100 Subject: [PATCH] K2: use MutableOrEmptyList for context receivers on declaration site --- .../declarations/builder/FirAnonymousFunctionBuilder.kt | 2 +- .../fir/declarations/builder/FirBackingFieldBuilder.kt | 2 +- .../fir/declarations/builder/FirConstructorBuilder.kt | 2 +- .../builder/FirDefaultSetterValueParameterBuilder.kt | 2 +- .../fir/declarations/builder/FirEnumEntryBuilder.kt | 2 +- .../fir/declarations/builder/FirErrorFunctionBuilder.kt | 2 +- .../fir/declarations/builder/FirErrorPropertyBuilder.kt | 2 +- .../kotlin/fir/declarations/builder/FirFieldBuilder.kt | 2 +- .../declarations/builder/FirPrimaryConstructorBuilder.kt | 2 +- .../declarations/builder/FirPropertyAccessorBuilder.kt | 2 +- .../kotlin/fir/declarations/builder/FirPropertyBuilder.kt | 2 +- .../fir/declarations/builder/FirRegularClassBuilder.kt | 2 +- .../kotlin/fir/declarations/builder/FirScriptBuilder.kt | 2 +- .../fir/declarations/builder/FirSimpleFunctionBuilder.kt | 2 +- .../fir/declarations/builder/FirValueParameterBuilder.kt | 2 +- .../fir/declarations/impl/FirAnonymousFunctionImpl.kt | 5 ++--- .../kotlin/fir/declarations/impl/FirBackingFieldImpl.kt | 5 ++--- .../kotlin/fir/declarations/impl/FirConstructorImpl.kt | 5 ++--- .../declarations/impl/FirDefaultSetterValueParameter.kt | 5 ++--- .../kotlin/fir/declarations/impl/FirEnumEntryImpl.kt | 5 ++--- .../kotlin/fir/declarations/impl/FirErrorFunctionImpl.kt | 5 ++--- .../kotlin/fir/declarations/impl/FirErrorPropertyImpl.kt | 5 ++--- .../kotlin/fir/declarations/impl/FirFieldImpl.kt | 5 ++--- .../kotlin/fir/declarations/impl/FirPrimaryConstructor.kt | 5 ++--- .../fir/declarations/impl/FirPropertyAccessorImpl.kt | 5 ++--- .../kotlin/fir/declarations/impl/FirPropertyImpl.kt | 5 ++--- .../kotlin/fir/declarations/impl/FirRegularClassImpl.kt | 2 +- .../kotlin/fir/declarations/impl/FirScriptImpl.kt | 2 +- .../kotlin/fir/declarations/impl/FirSimpleFunctionImpl.kt | 5 ++--- .../kotlin/fir/declarations/impl/FirValueParameterImpl.kt | 5 ++--- .../fir/declarations/impl/FirDefaultPropertyAccessor.kt | 2 +- .../declarations/impl/FirDefaultPropertyBackingField.kt | 3 ++- .../kotlin/fir/tree/generator/NodeConfigurator.kt | 8 ++++---- .../kotlin/fir/tree/generator/model/ElementUtils.kt | 4 ++-- 34 files changed, 52 insertions(+), 64 deletions(-) diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirAnonymousFunctionBuilder.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirAnonymousFunctionBuilder.kt index 0b3505da879..dd7487404c6 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirAnonymousFunctionBuilder.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirAnonymousFunctionBuilder.kt @@ -82,7 +82,7 @@ class FirAnonymousFunctionBuilder : FirFunctionBuilder, FirAnnotationContainerBu deprecationsProvider, containerSource, dispatchReceiverType, - contextReceivers, + contextReceivers.toMutableOrEmpty(), controlFlowGraphReference, valueParameters, body, diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirBackingFieldBuilder.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirBackingFieldBuilder.kt index 6ecfcddcc01..c602fc2d142 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirBackingFieldBuilder.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirBackingFieldBuilder.kt @@ -81,7 +81,7 @@ class FirBackingFieldBuilder : FirAnnotationContainerBuilder { deprecationsProvider, containerSource, dispatchReceiverType, - contextReceivers, + contextReceivers.toMutableOrEmpty(), name, delegate, isVar, diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirConstructorBuilder.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirConstructorBuilder.kt index e0de0611439..3dd7db61409 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirConstructorBuilder.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirConstructorBuilder.kt @@ -76,7 +76,7 @@ open class FirConstructorBuilder : FirAbstractConstructorBuilder, FirAnnotationC deprecationsProvider, containerSource, dispatchReceiverType, - contextReceivers, + contextReceivers.toMutableOrEmpty(), valueParameters, annotations.toMutableOrEmpty(), symbol, diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirDefaultSetterValueParameterBuilder.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirDefaultSetterValueParameterBuilder.kt index 45205a2a25e..e38764b0de2 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirDefaultSetterValueParameterBuilder.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirDefaultSetterValueParameterBuilder.kt @@ -83,7 +83,7 @@ class FirDefaultSetterValueParameterBuilder : FirAnnotationContainerBuilder { deprecationsProvider, containerSource, dispatchReceiverType, - contextReceivers, + contextReceivers.toMutableOrEmpty(), initializer, delegate, isVar, diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirEnumEntryBuilder.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirEnumEntryBuilder.kt index 18625f36a03..0a57a13ff3f 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirEnumEntryBuilder.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirEnumEntryBuilder.kt @@ -73,7 +73,7 @@ class FirEnumEntryBuilder : FirAnnotationContainerBuilder { deprecationsProvider, containerSource, dispatchReceiverType, - contextReceivers, + contextReceivers.toMutableOrEmpty(), name, initializer, backingField, diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirErrorFunctionBuilder.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirErrorFunctionBuilder.kt index e66c2c295b3..1e835598358 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirErrorFunctionBuilder.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirErrorFunctionBuilder.kt @@ -69,7 +69,7 @@ class FirErrorFunctionBuilder : FirAnnotationContainerBuilder { deprecationsProvider, containerSource, dispatchReceiverType, - contextReceivers, + contextReceivers.toMutableOrEmpty(), valueParameters, diagnostic, symbol, diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirErrorPropertyBuilder.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirErrorPropertyBuilder.kt index 91f27762ba5..9aa02dfd392 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirErrorPropertyBuilder.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirErrorPropertyBuilder.kt @@ -70,7 +70,7 @@ class FirErrorPropertyBuilder : FirAnnotationContainerBuilder { deprecationsProvider, containerSource, dispatchReceiverType, - contextReceivers, + contextReceivers.toMutableOrEmpty(), name, backingField, annotations.toMutableOrEmpty(), diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirFieldBuilder.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirFieldBuilder.kt index 65fe86b511b..ba0a67c1c94 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirFieldBuilder.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirFieldBuilder.kt @@ -78,7 +78,7 @@ open class FirFieldBuilder : FirDeclarationBuilder, FirAnnotationContainerBuilde deprecationsProvider, containerSource, dispatchReceiverType, - contextReceivers, + contextReceivers.toMutableOrEmpty(), name, initializer, isVar, diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirPrimaryConstructorBuilder.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirPrimaryConstructorBuilder.kt index ef095cdd9e0..35f8d58f3c7 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirPrimaryConstructorBuilder.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirPrimaryConstructorBuilder.kt @@ -78,7 +78,7 @@ class FirPrimaryConstructorBuilder : FirAbstractConstructorBuilder, FirAnnotatio deprecationsProvider, containerSource, dispatchReceiverType, - contextReceivers, + contextReceivers.toMutableOrEmpty(), valueParameters, annotations.toMutableOrEmpty(), symbol, diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirPropertyAccessorBuilder.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirPropertyAccessorBuilder.kt index dfbee3ba3cf..3a325c09668 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirPropertyAccessorBuilder.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirPropertyAccessorBuilder.kt @@ -80,7 +80,7 @@ class FirPropertyAccessorBuilder : FirFunctionBuilder, FirAnnotationContainerBui deprecationsProvider, containerSource, dispatchReceiverType, - contextReceivers, + contextReceivers.toMutableOrEmpty(), valueParameters, body, contractDescription, diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirPropertyBuilder.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirPropertyBuilder.kt index 7ba747227c0..390867b2000 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirPropertyBuilder.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirPropertyBuilder.kt @@ -95,7 +95,7 @@ class FirPropertyBuilder : FirDeclarationBuilder, FirTypeParametersOwnerBuilder, setter, backingField, annotations.toMutableOrEmpty(), - contextReceivers, + contextReceivers.toMutableOrEmpty(), symbol, delegateFieldSymbol, isLocal, diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirRegularClassBuilder.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirRegularClassBuilder.kt index 815791c8499..9129e2a7b8a 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirRegularClassBuilder.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirRegularClassBuilder.kt @@ -78,7 +78,7 @@ open class FirRegularClassBuilder : FirClassBuilder, FirTypeParameterRefsOwnerBu symbol, companionObjectSymbol, superTypeRefs, - contextReceivers, + contextReceivers.toMutableOrEmpty(), ) } diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirScriptBuilder.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirScriptBuilder.kt index 6a881a5355e..1439e23faf0 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirScriptBuilder.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirScriptBuilder.kt @@ -54,7 +54,7 @@ class FirScriptBuilder : FirAnnotationContainerBuilder { name, statements, symbol, - contextReceivers, + contextReceivers.toMutableOrEmpty(), ) } diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirSimpleFunctionBuilder.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirSimpleFunctionBuilder.kt index 3599403897e..ccab9438f49 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirSimpleFunctionBuilder.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirSimpleFunctionBuilder.kt @@ -79,7 +79,7 @@ open class FirSimpleFunctionBuilder : FirFunctionBuilder, FirTypeParametersOwner deprecationsProvider, containerSource, dispatchReceiverType, - contextReceivers, + contextReceivers.toMutableOrEmpty(), valueParameters, body, contractDescription, diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirValueParameterBuilder.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirValueParameterBuilder.kt index c12cf9eb915..bf89cb15149 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirValueParameterBuilder.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirValueParameterBuilder.kt @@ -76,7 +76,7 @@ open class FirValueParameterBuilder : FirAnnotationContainerBuilder { deprecationsProvider, containerSource, dispatchReceiverType, - contextReceivers, + contextReceivers.toMutableOrEmpty(), name, backingField, annotations.toMutableOrEmpty(), diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirAnonymousFunctionImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirAnonymousFunctionImpl.kt index 48f3c924599..82b433b6f84 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirAnonymousFunctionImpl.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirAnonymousFunctionImpl.kt @@ -50,7 +50,7 @@ internal class FirAnonymousFunctionImpl( override var deprecationsProvider: DeprecationsProvider, override val containerSource: DeserializedContainerSource?, override val dispatchReceiverType: ConeSimpleKotlinType?, - override val contextReceivers: MutableList, + override var contextReceivers: MutableOrEmptyList, override var controlFlowGraphReference: FirControlFlowGraphReference?, override val valueParameters: MutableList, override var body: FirBlock?, @@ -156,8 +156,7 @@ internal class FirAnonymousFunctionImpl( } override fun replaceContextReceivers(newContextReceivers: List) { - contextReceivers.clear() - contextReceivers.addAll(newContextReceivers) + contextReceivers = newContextReceivers.toMutableOrEmpty() } override fun replaceControlFlowGraphReference(newControlFlowGraphReference: FirControlFlowGraphReference?) { diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirBackingFieldImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirBackingFieldImpl.kt index b8b42f9ffc3..6fe04b71a9c 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirBackingFieldImpl.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirBackingFieldImpl.kt @@ -49,7 +49,7 @@ open class FirBackingFieldImpl @FirImplementationDetail constructor( override var deprecationsProvider: DeprecationsProvider, override val containerSource: DeserializedContainerSource?, override val dispatchReceiverType: ConeSimpleKotlinType?, - override val contextReceivers: MutableList, + override var contextReceivers: MutableOrEmptyList, override val name: Name, override var delegate: FirExpression?, override val isVar: Boolean, @@ -169,8 +169,7 @@ open class FirBackingFieldImpl @FirImplementationDetail constructor( } override fun replaceContextReceivers(newContextReceivers: List) { - contextReceivers.clear() - contextReceivers.addAll(newContextReceivers) + contextReceivers = newContextReceivers.toMutableOrEmpty() } override fun replaceGetter(newGetter: FirPropertyAccessor?) { diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirConstructorImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirConstructorImpl.kt index a0bbbca4c98..d3427aaaf5a 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirConstructorImpl.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirConstructorImpl.kt @@ -50,7 +50,7 @@ internal class FirConstructorImpl( override var deprecationsProvider: DeprecationsProvider, override val containerSource: DeserializedContainerSource?, override val dispatchReceiverType: ConeSimpleKotlinType?, - override val contextReceivers: MutableList, + override var contextReceivers: MutableOrEmptyList, override val valueParameters: MutableList, override var annotations: MutableOrEmptyList, override val symbol: FirConstructorSymbol, @@ -148,8 +148,7 @@ internal class FirConstructorImpl( } override fun replaceContextReceivers(newContextReceivers: List) { - contextReceivers.clear() - contextReceivers.addAll(newContextReceivers) + contextReceivers = newContextReceivers.toMutableOrEmpty() } override fun replaceControlFlowGraphReference(newControlFlowGraphReference: FirControlFlowGraphReference?) { diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirDefaultSetterValueParameter.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirDefaultSetterValueParameter.kt index 2a2377d87a3..181fd687fb3 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirDefaultSetterValueParameter.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirDefaultSetterValueParameter.kt @@ -51,7 +51,7 @@ internal class FirDefaultSetterValueParameter( override var deprecationsProvider: DeprecationsProvider, override val containerSource: DeserializedContainerSource?, override val dispatchReceiverType: ConeSimpleKotlinType?, - override val contextReceivers: MutableList, + override var contextReceivers: MutableOrEmptyList, override var initializer: FirExpression?, override var delegate: FirExpression?, override val isVar: Boolean, @@ -178,8 +178,7 @@ internal class FirDefaultSetterValueParameter( } override fun replaceContextReceivers(newContextReceivers: List) { - contextReceivers.clear() - contextReceivers.addAll(newContextReceivers) + contextReceivers = newContextReceivers.toMutableOrEmpty() } override fun replaceInitializer(newInitializer: FirExpression?) { diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirEnumEntryImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirEnumEntryImpl.kt index e391ba3343a..02ea23c2209 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirEnumEntryImpl.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirEnumEntryImpl.kt @@ -49,7 +49,7 @@ internal class FirEnumEntryImpl( override var deprecationsProvider: DeprecationsProvider, override val containerSource: DeserializedContainerSource?, override val dispatchReceiverType: ConeSimpleKotlinType?, - override val contextReceivers: MutableList, + override var contextReceivers: MutableOrEmptyList, override val name: Name, override var initializer: FirExpression?, override var backingField: FirBackingField?, @@ -154,8 +154,7 @@ internal class FirEnumEntryImpl( } override fun replaceContextReceivers(newContextReceivers: List) { - contextReceivers.clear() - contextReceivers.addAll(newContextReceivers) + contextReceivers = newContextReceivers.toMutableOrEmpty() } override fun replaceInitializer(newInitializer: FirExpression?) { diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirErrorFunctionImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirErrorFunctionImpl.kt index 7459c445daf..95757624b76 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirErrorFunctionImpl.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirErrorFunctionImpl.kt @@ -49,7 +49,7 @@ internal class FirErrorFunctionImpl( override var deprecationsProvider: DeprecationsProvider, override val containerSource: DeserializedContainerSource?, override val dispatchReceiverType: ConeSimpleKotlinType?, - override val contextReceivers: MutableList, + override var contextReceivers: MutableOrEmptyList, override val valueParameters: MutableList, override val diagnostic: ConeDiagnostic, override val symbol: FirErrorFunctionSymbol, @@ -135,8 +135,7 @@ internal class FirErrorFunctionImpl( } override fun replaceContextReceivers(newContextReceivers: List) { - contextReceivers.clear() - contextReceivers.addAll(newContextReceivers) + contextReceivers = newContextReceivers.toMutableOrEmpty() } override fun replaceControlFlowGraphReference(newControlFlowGraphReference: FirControlFlowGraphReference?) { diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirErrorPropertyImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirErrorPropertyImpl.kt index a17add26729..6566f9893ae 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirErrorPropertyImpl.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirErrorPropertyImpl.kt @@ -49,7 +49,7 @@ internal class FirErrorPropertyImpl( override var deprecationsProvider: DeprecationsProvider, override val containerSource: DeserializedContainerSource?, override val dispatchReceiverType: ConeSimpleKotlinType?, - override val contextReceivers: MutableList, + override var contextReceivers: MutableOrEmptyList, override val name: Name, override var backingField: FirBackingField?, override var annotations: MutableOrEmptyList, @@ -152,8 +152,7 @@ internal class FirErrorPropertyImpl( } override fun replaceContextReceivers(newContextReceivers: List) { - contextReceivers.clear() - contextReceivers.addAll(newContextReceivers) + contextReceivers = newContextReceivers.toMutableOrEmpty() } override fun replaceInitializer(newInitializer: FirExpression?) {} diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirFieldImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirFieldImpl.kt index 32a9b0b6d9e..dc8aa9c01d9 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirFieldImpl.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirFieldImpl.kt @@ -51,7 +51,7 @@ class FirFieldImpl @FirImplementationDetail constructor( override var deprecationsProvider: DeprecationsProvider, override val containerSource: DeserializedContainerSource?, override val dispatchReceiverType: ConeSimpleKotlinType?, - override val contextReceivers: MutableList, + override var contextReceivers: MutableOrEmptyList, override val name: Name, override var initializer: FirExpression?, override val isVar: Boolean, @@ -159,8 +159,7 @@ class FirFieldImpl @FirImplementationDetail constructor( } override fun replaceContextReceivers(newContextReceivers: List) { - contextReceivers.clear() - contextReceivers.addAll(newContextReceivers) + contextReceivers = newContextReceivers.toMutableOrEmpty() } override fun replaceInitializer(newInitializer: FirExpression?) { diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirPrimaryConstructor.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirPrimaryConstructor.kt index 0bae8beeb45..17c4c1bf182 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirPrimaryConstructor.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirPrimaryConstructor.kt @@ -51,7 +51,7 @@ class FirPrimaryConstructor @FirImplementationDetail constructor( override var deprecationsProvider: DeprecationsProvider, override val containerSource: DeserializedContainerSource?, override val dispatchReceiverType: ConeSimpleKotlinType?, - override val contextReceivers: MutableList, + override var contextReceivers: MutableOrEmptyList, override val valueParameters: MutableList, override var annotations: MutableOrEmptyList, override val symbol: FirConstructorSymbol, @@ -149,8 +149,7 @@ class FirPrimaryConstructor @FirImplementationDetail constructor( } override fun replaceContextReceivers(newContextReceivers: List) { - contextReceivers.clear() - contextReceivers.addAll(newContextReceivers) + contextReceivers = newContextReceivers.toMutableOrEmpty() } override fun replaceControlFlowGraphReference(newControlFlowGraphReference: FirControlFlowGraphReference?) { diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirPropertyAccessorImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirPropertyAccessorImpl.kt index 49094f20fa9..0d2869a1701 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirPropertyAccessorImpl.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirPropertyAccessorImpl.kt @@ -51,7 +51,7 @@ open class FirPropertyAccessorImpl @FirImplementationDetail constructor( override var deprecationsProvider: DeprecationsProvider, override val containerSource: DeserializedContainerSource?, override val dispatchReceiverType: ConeSimpleKotlinType?, - override val contextReceivers: MutableList, + override var contextReceivers: MutableOrEmptyList, override val valueParameters: MutableList, override var body: FirBlock?, override var contractDescription: FirContractDescription, @@ -148,8 +148,7 @@ open class FirPropertyAccessorImpl @FirImplementationDetail constructor( } override fun replaceContextReceivers(newContextReceivers: List) { - contextReceivers.clear() - contextReceivers.addAll(newContextReceivers) + contextReceivers = newContextReceivers.toMutableOrEmpty() } override fun replaceControlFlowGraphReference(newControlFlowGraphReference: FirControlFlowGraphReference?) { diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirPropertyImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirPropertyImpl.kt index 34faa332293..2d01d0eb5c2 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirPropertyImpl.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirPropertyImpl.kt @@ -61,7 +61,7 @@ internal class FirPropertyImpl( override var setter: FirPropertyAccessor?, override var backingField: FirBackingField?, override var annotations: MutableOrEmptyList, - override val contextReceivers: MutableList, + override var contextReceivers: MutableOrEmptyList, override val symbol: FirPropertySymbol, override val delegateFieldSymbol: FirDelegateFieldSymbol?, override val isLocal: Boolean, @@ -204,8 +204,7 @@ internal class FirPropertyImpl( } override fun replaceContextReceivers(newContextReceivers: List) { - contextReceivers.clear() - contextReceivers.addAll(newContextReceivers) + contextReceivers = newContextReceivers.toMutableOrEmpty() } override fun replaceBodyResolveState(newBodyResolveState: FirPropertyBodyResolveState) { diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirRegularClassImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirRegularClassImpl.kt index b53f88a7f96..fb8e62d55f1 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirRegularClassImpl.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirRegularClassImpl.kt @@ -52,7 +52,7 @@ internal class FirRegularClassImpl( override val symbol: FirRegularClassSymbol, override var companionObjectSymbol: FirRegularClassSymbol?, override val superTypeRefs: MutableList, - override val contextReceivers: MutableList, + override var contextReceivers: MutableOrEmptyList, ) : FirRegularClass() { override var controlFlowGraphReference: FirControlFlowGraphReference? = null override val hasLazyNestedClassifiers: Boolean get() = false diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirScriptImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirScriptImpl.kt index a165893f178..ab7e5ddab2a 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirScriptImpl.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirScriptImpl.kt @@ -38,7 +38,7 @@ internal class FirScriptImpl( override val name: Name, override val statements: MutableList, override val symbol: FirScriptSymbol, - override val contextReceivers: MutableList, + override var contextReceivers: MutableOrEmptyList, ) : FirScript() { init { symbol.bind(this) diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirSimpleFunctionImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirSimpleFunctionImpl.kt index f4d6bc16854..57a70e464bf 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirSimpleFunctionImpl.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirSimpleFunctionImpl.kt @@ -50,7 +50,7 @@ internal class FirSimpleFunctionImpl( override var deprecationsProvider: DeprecationsProvider, override val containerSource: DeserializedContainerSource?, override val dispatchReceiverType: ConeSimpleKotlinType?, - override val contextReceivers: MutableList, + override var contextReceivers: MutableOrEmptyList, override val valueParameters: MutableList, override var body: FirBlock?, override var contractDescription: FirContractDescription, @@ -149,8 +149,7 @@ internal class FirSimpleFunctionImpl( } override fun replaceContextReceivers(newContextReceivers: List) { - contextReceivers.clear() - contextReceivers.addAll(newContextReceivers) + contextReceivers = newContextReceivers.toMutableOrEmpty() } override fun replaceControlFlowGraphReference(newControlFlowGraphReference: FirControlFlowGraphReference?) { diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirValueParameterImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirValueParameterImpl.kt index a4b352c97b2..b7df2d4abec 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirValueParameterImpl.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirValueParameterImpl.kt @@ -50,7 +50,7 @@ internal class FirValueParameterImpl( override var deprecationsProvider: DeprecationsProvider, override val containerSource: DeserializedContainerSource?, override val dispatchReceiverType: ConeSimpleKotlinType?, - override val contextReceivers: MutableList, + override var contextReceivers: MutableOrEmptyList, override val name: Name, override var backingField: FirBackingField?, override var annotations: MutableOrEmptyList, @@ -161,8 +161,7 @@ internal class FirValueParameterImpl( } override fun replaceContextReceivers(newContextReceivers: List) { - contextReceivers.clear() - contextReceivers.addAll(newContextReceivers) + contextReceivers = newContextReceivers.toMutableOrEmpty() } override fun replaceInitializer(newInitializer: FirExpression?) {} diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/impl/FirDefaultPropertyAccessor.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/impl/FirDefaultPropertyAccessor.kt index 248f4321916..953d561193c 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/impl/FirDefaultPropertyAccessor.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/impl/FirDefaultPropertyAccessor.kt @@ -54,7 +54,7 @@ abstract class FirDefaultPropertyAccessor( deprecationsProvider = UnresolvedDeprecationProvider, containerSource = null, dispatchReceiverType = null, - contextReceivers = mutableListOf(), + contextReceivers = MutableOrEmptyList.empty(), valueParameters, body = null, contractDescription = FirEmptyContractDescription, diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/impl/FirDefaultPropertyBackingField.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/impl/FirDefaultPropertyBackingField.kt index 62bcec26aac..7906626457e 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/impl/FirDefaultPropertyBackingField.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/impl/FirDefaultPropertyBackingField.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.declarations.impl import org.jetbrains.kotlin.builtins.StandardNames.BACKING_FIELD import org.jetbrains.kotlin.fir.FirImplementationDetail import org.jetbrains.kotlin.fir.FirModuleData +import org.jetbrains.kotlin.fir.MutableOrEmptyList import org.jetbrains.kotlin.fir.builder.toMutableOrEmpty import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.expressions.FirAnnotation @@ -48,6 +49,6 @@ class FirDefaultPropertyBackingField( annotations = annotations.toMutableOrEmpty(), typeParameters = mutableListOf(), status = status, - contextReceivers = mutableListOf(), + contextReceivers = MutableOrEmptyList.empty(), ) 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 06f8c137516..5c5f0578224 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 @@ -103,7 +103,7 @@ object NodeConfigurator : AbstractFieldConfigurator(FirTreeBuild +field("containerSource", type(DeserializedContainerSource::class), nullable = true) +field("dispatchReceiverType", coneSimpleKotlinTypeType, nullable = true) - +fieldList(contextReceiver, withReplace = true) + +fieldList(contextReceiver, useMutableOrEmpty = true, withReplace = true) } function.configure { @@ -284,7 +284,7 @@ object NodeConfigurator : AbstractFieldConfigurator(FirTreeBuild +booleanField("hasLazyNestedClassifiers") +field("companionObjectSymbol", regularClassSymbolType, nullable = true, withReplace = true) +superTypeRefs(withReplace = true) - +fieldList(contextReceiver) + +fieldList(contextReceiver, useMutableOrEmpty = true) } anonymousObject.configure { @@ -346,7 +346,7 @@ object NodeConfigurator : AbstractFieldConfigurator(FirTreeBuild } property.configure { - +fieldList(contextReceiver, withReplace = true).withTransform() + +fieldList(contextReceiver, useMutableOrEmpty = true, withReplace = true).withTransform() +symbol("FirPropertySymbol") +field("delegateFieldSymbol", delegateFieldSymbolType, nullable = true) +booleanField("isLocal") @@ -471,7 +471,7 @@ object NodeConfigurator : AbstractFieldConfigurator(FirTreeBuild +name +fieldList(statement).withTransform() +symbol("FirScriptSymbol") - +fieldList(contextReceiver) + +fieldList(contextReceiver, useMutableOrEmpty = true) } packageDirective.configure { diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/model/ElementUtils.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/model/ElementUtils.kt index 9e1c74ce1fb..473acabfef3 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/model/ElementUtils.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/model/ElementUtils.kt @@ -66,8 +66,8 @@ fun fieldList(name: String, type: Importable, withReplace: Boolean = false, useM return FieldList(name, type, withReplace, useMutableOrEmpty) } -fun fieldList(element: AbstractElement, withReplace: Boolean = false): Field { - return FieldList(element.name.replaceFirstChar(Char::lowercaseChar) + "s", element, withReplace) +fun fieldList(element: AbstractElement, withReplace: Boolean = false, useMutableOrEmpty: Boolean = false): Field { + return FieldList(element.name.replaceFirstChar(Char::lowercaseChar) + "s", element, withReplace, useMutableOrEmpty) } // ----------- Field set -----------