K2: calculate deprecations for backing field properly
#KT-58224 Fixed
This commit is contained in:
committed by
Space Team
parent
94c94d0605
commit
180613e1c6
+4
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.descriptors.annotations.KotlinTarget
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.getAllowedAnnotationTargets
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.languageVersionSettings
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirBackingFieldSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
@@ -46,6 +47,9 @@ internal class KtFirSymbolInfoProvider(
|
||||
firSymbol.getDeprecationForCallSite(apiVersion, AnnotationUseSiteTarget.PROPERTY)
|
||||
?: firSymbol.backingFieldSymbol?.getDeprecationForCallSite(apiVersion, AnnotationUseSiteTarget.FIELD)
|
||||
}
|
||||
is FirBackingFieldSymbol -> {
|
||||
firSymbol.getDeprecationForCallSite(apiVersion, AnnotationUseSiteTarget.FIELD)
|
||||
}
|
||||
else -> {
|
||||
firSymbol.getDeprecationForCallSite(apiVersion)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
|
||||
|
||||
import java.lang.Deprecated
|
||||
|
||||
annotation class PropertyAnnotation
|
||||
annotation class FieldAnnotation
|
||||
annotation class GetAnnotation
|
||||
@@ -10,6 +13,7 @@ annotation class ExplicitSetparamAnnotation
|
||||
|
||||
@property:PropertyAnnotation
|
||||
@field:FieldAnnotation
|
||||
@field:Deprecated
|
||||
@get:GetAnnotation
|
||||
@set:SetAnnotation
|
||||
@setparam:SetparamAnnotation
|
||||
|
||||
+1
@@ -1,2 +1,3 @@
|
||||
@FieldAnnotation
|
||||
@java.lang.Deprecated
|
||||
field
|
||||
@@ -2,6 +2,8 @@ KtBackingFieldSymbol:
|
||||
annotationsList: [
|
||||
FieldAnnotation()
|
||||
psi: KtAnnotationEntry
|
||||
java/lang/Deprecated()
|
||||
psi: KtAnnotationEntry
|
||||
]
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
@@ -17,4 +19,4 @@ KtBackingFieldSymbol:
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
deprecationStatus: DeprecationInfo(deprecationLevel=WARNING, propagatesToOverrides=false, message=null)
|
||||
+6
@@ -239,6 +239,12 @@ open class FirTypeResolveTransformer(
|
||||
}
|
||||
}
|
||||
|
||||
override fun transformBackingField(backingField: FirBackingField, data: Any?): FirStatement = whileAnalysing(session, backingField) {
|
||||
backingField.transformAnnotations(this, data)
|
||||
calculateDeprecations(backingField)
|
||||
super.transformBackingField(backingField, data)
|
||||
}
|
||||
|
||||
override fun transformSimpleFunction(
|
||||
simpleFunction: FirSimpleFunction,
|
||||
data: Any?,
|
||||
|
||||
Reference in New Issue
Block a user