[FIR] set correct resolve phase for default getter, setter and backing field
^KT-58163 Fixed
This commit is contained in:
committed by
Space Team
parent
1703d3a47e
commit
866e8a26c7
+5
-3
@@ -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.
|
* 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,
|
visibility,
|
||||||
propertySymbol,
|
propertySymbol,
|
||||||
propertyModality,
|
propertyModality,
|
||||||
effectiveVisibility
|
effectiveVisibility,
|
||||||
|
resolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES,
|
||||||
)
|
)
|
||||||
}.apply {
|
}.apply {
|
||||||
replaceAnnotations(
|
replaceAnnotations(
|
||||||
@@ -324,7 +325,8 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) {
|
|||||||
visibility,
|
visibility,
|
||||||
propertySymbol,
|
propertySymbol,
|
||||||
propertyModality,
|
propertyModality,
|
||||||
effectiveVisibility
|
effectiveVisibility,
|
||||||
|
resolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES,
|
||||||
)
|
)
|
||||||
}.apply {
|
}.apply {
|
||||||
replaceAnnotations(
|
replaceAnnotations(
|
||||||
|
|||||||
+9
-4
@@ -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.
|
* 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
|
isVar = !isVal
|
||||||
getter = FirDefaultPropertyGetter(
|
getter = FirDefaultPropertyGetter(
|
||||||
source = null, session.moduleData, key.origin, returnTypeRef, status.visibility, symbol,
|
source = null, session.moduleData, key.origin, returnTypeRef, status.visibility, symbol,
|
||||||
Modality.FINAL, resolvedStatus.effectiveVisibility
|
Modality.FINAL, resolvedStatus.effectiveVisibility,
|
||||||
|
resolvePhase = FirResolvePhase.BODY_RESOLVE,
|
||||||
)
|
)
|
||||||
if (isVar) {
|
if (isVar) {
|
||||||
setter = FirDefaultPropertySetter(
|
setter = FirDefaultPropertySetter(
|
||||||
source = null, session.moduleData, key.origin, returnTypeRef, setterVisibility ?: status.visibility,
|
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 {
|
} else {
|
||||||
require(setterVisibility == null) { "isVar = false but setterVisibility is specified. Did you forget to set isVar = true?" }
|
require(setterVisibility == null) { "isVar = false but setterVisibility is specified. Did you forget to set isVar = true?" }
|
||||||
}
|
}
|
||||||
if (hasBackingField) {
|
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
|
isLocal = false
|
||||||
bodyResolveState = FirPropertyBodyResolveState.EVERYTHING_RESOLVED
|
bodyResolveState = FirPropertyBodyResolveState.EVERYTHING_RESOLVED
|
||||||
|
|||||||
+2
@@ -443,6 +443,7 @@ object FirFakeOverrideGenerator {
|
|||||||
propertySymbol = propertySymbol,
|
propertySymbol = propertySymbol,
|
||||||
modality = modality ?: Modality.FINAL,
|
modality = modality ?: Modality.FINAL,
|
||||||
effectiveVisibility = effectiveVisibility,
|
effectiveVisibility = effectiveVisibility,
|
||||||
|
resolvePhase = resolvePhase,
|
||||||
).apply {
|
).apply {
|
||||||
replaceAnnotations(annotations)
|
replaceAnnotations(annotations)
|
||||||
}
|
}
|
||||||
@@ -455,6 +456,7 @@ object FirFakeOverrideGenerator {
|
|||||||
propertySymbol = propertySymbol,
|
propertySymbol = propertySymbol,
|
||||||
modality = modality ?: Modality.FINAL,
|
modality = modality ?: Modality.FINAL,
|
||||||
effectiveVisibility = effectiveVisibility,
|
effectiveVisibility = effectiveVisibility,
|
||||||
|
resolvePhase = resolvePhase,
|
||||||
).apply {
|
).apply {
|
||||||
replaceAnnotations(annotations)
|
replaceAnnotations(annotations)
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-6
@@ -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.
|
* 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,
|
visibility: Visibility,
|
||||||
modality: Modality = Modality.FINAL,
|
modality: Modality = Modality.FINAL,
|
||||||
effectiveVisibility: EffectiveVisibility? = null,
|
effectiveVisibility: EffectiveVisibility? = null,
|
||||||
symbol: FirPropertyAccessorSymbol
|
symbol: FirPropertyAccessorSymbol,
|
||||||
|
resolvePhase: FirResolvePhase,
|
||||||
) : FirPropertyAccessorImpl(
|
) : FirPropertyAccessorImpl(
|
||||||
source,
|
source,
|
||||||
resolvePhase = FirResolvePhase.RAW_FIR,
|
resolvePhase,
|
||||||
moduleData,
|
moduleData,
|
||||||
origin,
|
origin,
|
||||||
FirDeclarationAttributes(),
|
FirDeclarationAttributes(),
|
||||||
@@ -103,7 +104,8 @@ class FirDefaultPropertyGetter(
|
|||||||
propertySymbol: FirPropertySymbol,
|
propertySymbol: FirPropertySymbol,
|
||||||
modality: Modality = Modality.FINAL,
|
modality: Modality = Modality.FINAL,
|
||||||
effectiveVisibility: EffectiveVisibility? = null,
|
effectiveVisibility: EffectiveVisibility? = null,
|
||||||
symbol: FirPropertyAccessorSymbol = FirPropertyAccessorSymbol()
|
symbol: FirPropertyAccessorSymbol = FirPropertyAccessorSymbol(),
|
||||||
|
resolvePhase: FirResolvePhase = FirResolvePhase.RAW_FIR,
|
||||||
) : FirDefaultPropertyAccessor(
|
) : FirDefaultPropertyAccessor(
|
||||||
source,
|
source,
|
||||||
moduleData,
|
moduleData,
|
||||||
@@ -115,7 +117,8 @@ class FirDefaultPropertyGetter(
|
|||||||
visibility = visibility,
|
visibility = visibility,
|
||||||
modality = modality,
|
modality = modality,
|
||||||
effectiveVisibility = effectiveVisibility,
|
effectiveVisibility = effectiveVisibility,
|
||||||
symbol = symbol
|
symbol = symbol,
|
||||||
|
resolvePhase = resolvePhase,
|
||||||
)
|
)
|
||||||
|
|
||||||
class FirDefaultPropertySetter(
|
class FirDefaultPropertySetter(
|
||||||
@@ -129,6 +132,7 @@ class FirDefaultPropertySetter(
|
|||||||
effectiveVisibility: EffectiveVisibility? = null,
|
effectiveVisibility: EffectiveVisibility? = null,
|
||||||
propertyAccessorSymbol: FirPropertyAccessorSymbol = FirPropertyAccessorSymbol(),
|
propertyAccessorSymbol: FirPropertyAccessorSymbol = FirPropertyAccessorSymbol(),
|
||||||
parameterAnnotations: List<FirAnnotation> = emptyList(),
|
parameterAnnotations: List<FirAnnotation> = emptyList(),
|
||||||
|
resolvePhase: FirResolvePhase = FirResolvePhase.RAW_FIR,
|
||||||
) : FirDefaultPropertyAccessor(
|
) : FirDefaultPropertyAccessor(
|
||||||
source,
|
source,
|
||||||
moduleData,
|
moduleData,
|
||||||
@@ -136,6 +140,7 @@ class FirDefaultPropertySetter(
|
|||||||
FirImplicitUnitTypeRef(source),
|
FirImplicitUnitTypeRef(source),
|
||||||
valueParameters = mutableListOf(
|
valueParameters = mutableListOf(
|
||||||
buildDefaultSetterValueParameter builder@{
|
buildDefaultSetterValueParameter builder@{
|
||||||
|
this@builder.resolvePhase = resolvePhase
|
||||||
this@builder.source = source?.fakeElement(KtFakeSourceElementKind.DefaultAccessor)
|
this@builder.source = source?.fakeElement(KtFakeSourceElementKind.DefaultAccessor)
|
||||||
this@builder.containingFunctionSymbol = propertyAccessorSymbol
|
this@builder.containingFunctionSymbol = propertyAccessorSymbol
|
||||||
this@builder.moduleData = moduleData
|
this@builder.moduleData = moduleData
|
||||||
@@ -150,5 +155,6 @@ class FirDefaultPropertySetter(
|
|||||||
visibility = visibility,
|
visibility = visibility,
|
||||||
modality = modality,
|
modality = modality,
|
||||||
effectiveVisibility = effectiveVisibility,
|
effectiveVisibility = effectiveVisibility,
|
||||||
symbol = propertyAccessorSymbol
|
symbol = propertyAccessorSymbol,
|
||||||
|
resolvePhase = resolvePhase,
|
||||||
)
|
)
|
||||||
|
|||||||
+3
-2
@@ -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.
|
* 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,
|
isVar: Boolean,
|
||||||
propertySymbol: FirPropertySymbol,
|
propertySymbol: FirPropertySymbol,
|
||||||
status: FirDeclarationStatus,
|
status: FirDeclarationStatus,
|
||||||
|
resolvePhase: FirResolvePhase = FirResolvePhase.RAW_FIR,
|
||||||
) : FirBackingFieldImpl(
|
) : FirBackingFieldImpl(
|
||||||
source = null,
|
source = null,
|
||||||
moduleData = moduleData,
|
moduleData = moduleData,
|
||||||
resolvePhase = FirResolvePhase.RAW_FIR,
|
resolvePhase = resolvePhase,
|
||||||
origin = FirDeclarationOrigin.Synthetic,
|
origin = FirDeclarationOrigin.Synthetic,
|
||||||
attributes = FirDeclarationAttributes(),
|
attributes = FirDeclarationAttributes(),
|
||||||
returnTypeRef = returnTypeRef,
|
returnTypeRef = returnTypeRef,
|
||||||
|
|||||||
Reference in New Issue
Block a user