diff --git a/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/FirMemberDeserializer.kt b/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/FirMemberDeserializer.kt index ab1137de601..548b40d44c4 100644 --- a/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/FirMemberDeserializer.kt +++ b/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/FirMemberDeserializer.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 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. */ @@ -265,7 +265,8 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) { visibility, propertySymbol, propertyModality, - effectiveVisibility + effectiveVisibility, + resolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES, ) }.apply { replaceAnnotations( @@ -324,7 +325,8 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) { visibility, propertySymbol, propertyModality, - effectiveVisibility + effectiveVisibility, + resolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES, ) }.apply { replaceAnnotations( diff --git a/compiler/fir/plugin-utils/src/org/jetbrains/kotlin/fir/plugin/PropertyBuildingContext.kt b/compiler/fir/plugin-utils/src/org/jetbrains/kotlin/fir/plugin/PropertyBuildingContext.kt index 4696cb08cad..9099e814b4f 100644 --- a/compiler/fir/plugin-utils/src/org/jetbrains/kotlin/fir/plugin/PropertyBuildingContext.kt +++ b/compiler/fir/plugin-utils/src/org/jetbrains/kotlin/fir/plugin/PropertyBuildingContext.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 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. */ @@ -93,18 +93,23 @@ public class PropertyBuildingContext( isVar = !isVal getter = FirDefaultPropertyGetter( source = null, session.moduleData, key.origin, returnTypeRef, status.visibility, symbol, - Modality.FINAL, resolvedStatus.effectiveVisibility + Modality.FINAL, resolvedStatus.effectiveVisibility, + resolvePhase = FirResolvePhase.BODY_RESOLVE, ) if (isVar) { setter = FirDefaultPropertySetter( source = null, session.moduleData, key.origin, returnTypeRef, setterVisibility ?: status.visibility, - symbol, Modality.FINAL, resolvedStatus.effectiveVisibility + symbol, Modality.FINAL, resolvedStatus.effectiveVisibility, + resolvePhase = FirResolvePhase.BODY_RESOLVE, ) } else { require(setterVisibility == null) { "isVar = false but setterVisibility is specified. Did you forget to set isVar = true?" } } if (hasBackingField) { - backingField = FirDefaultPropertyBackingField(session.moduleData, mutableListOf(), returnTypeRef, isVar, symbol, status) + backingField = FirDefaultPropertyBackingField( + session.moduleData, mutableListOf(), returnTypeRef, isVar, symbol, status, + resolvePhase = FirResolvePhase.BODY_RESOLVE, + ) } isLocal = false bodyResolveState = FirPropertyBodyResolveState.EVERYTHING_RESOLVED diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirFakeOverrideGenerator.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirFakeOverrideGenerator.kt index 98463e4e16b..f056490d7ae 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirFakeOverrideGenerator.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirFakeOverrideGenerator.kt @@ -443,6 +443,7 @@ object FirFakeOverrideGenerator { propertySymbol = propertySymbol, modality = modality ?: Modality.FINAL, effectiveVisibility = effectiveVisibility, + resolvePhase = resolvePhase, ).apply { replaceAnnotations(annotations) } @@ -455,6 +456,7 @@ object FirFakeOverrideGenerator { propertySymbol = propertySymbol, modality = modality ?: Modality.FINAL, effectiveVisibility = effectiveVisibility, + resolvePhase = resolvePhase, ).apply { replaceAnnotations(annotations) } 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 953d561193c..48bc731720c 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 @@ -1,5 +1,5 @@ /* - * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 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. */ @@ -39,10 +39,11 @@ abstract class FirDefaultPropertyAccessor( visibility: Visibility, modality: Modality = Modality.FINAL, effectiveVisibility: EffectiveVisibility? = null, - symbol: FirPropertyAccessorSymbol + symbol: FirPropertyAccessorSymbol, + resolvePhase: FirResolvePhase, ) : FirPropertyAccessorImpl( source, - resolvePhase = FirResolvePhase.RAW_FIR, + resolvePhase, moduleData, origin, FirDeclarationAttributes(), @@ -103,7 +104,8 @@ class FirDefaultPropertyGetter( propertySymbol: FirPropertySymbol, modality: Modality = Modality.FINAL, effectiveVisibility: EffectiveVisibility? = null, - symbol: FirPropertyAccessorSymbol = FirPropertyAccessorSymbol() + symbol: FirPropertyAccessorSymbol = FirPropertyAccessorSymbol(), + resolvePhase: FirResolvePhase = FirResolvePhase.RAW_FIR, ) : FirDefaultPropertyAccessor( source, moduleData, @@ -115,7 +117,8 @@ class FirDefaultPropertyGetter( visibility = visibility, modality = modality, effectiveVisibility = effectiveVisibility, - symbol = symbol + symbol = symbol, + resolvePhase = resolvePhase, ) class FirDefaultPropertySetter( @@ -129,6 +132,7 @@ class FirDefaultPropertySetter( effectiveVisibility: EffectiveVisibility? = null, propertyAccessorSymbol: FirPropertyAccessorSymbol = FirPropertyAccessorSymbol(), parameterAnnotations: List = emptyList(), + resolvePhase: FirResolvePhase = FirResolvePhase.RAW_FIR, ) : FirDefaultPropertyAccessor( source, moduleData, @@ -136,6 +140,7 @@ class FirDefaultPropertySetter( FirImplicitUnitTypeRef(source), valueParameters = mutableListOf( buildDefaultSetterValueParameter builder@{ + this@builder.resolvePhase = resolvePhase this@builder.source = source?.fakeElement(KtFakeSourceElementKind.DefaultAccessor) this@builder.containingFunctionSymbol = propertyAccessorSymbol this@builder.moduleData = moduleData @@ -150,5 +155,6 @@ class FirDefaultPropertySetter( visibility = visibility, modality = modality, effectiveVisibility = effectiveVisibility, - symbol = propertyAccessorSymbol + symbol = propertyAccessorSymbol, + resolvePhase = resolvePhase, ) 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 7906626457e..4e2750e6425 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 @@ -1,5 +1,5 @@ /* - * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 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. */ @@ -25,10 +25,11 @@ class FirDefaultPropertyBackingField( isVar: Boolean, propertySymbol: FirPropertySymbol, status: FirDeclarationStatus, + resolvePhase: FirResolvePhase = FirResolvePhase.RAW_FIR, ) : FirBackingFieldImpl( source = null, moduleData = moduleData, - resolvePhase = FirResolvePhase.RAW_FIR, + resolvePhase = resolvePhase, origin = FirDeclarationOrigin.Synthetic, attributes = FirDeclarationAttributes(), returnTypeRef = returnTypeRef,