FIR LC: do not ignore useSite target for getting deprecation status
This commit is contained in:
+1
-1
@@ -41,7 +41,7 @@ internal fun isHiddenByDeprecation(
|
||||
annotationUseSiteTarget: AnnotationUseSiteTarget? = null
|
||||
): Boolean {
|
||||
return project.analyzeWithSymbolAsContext(symbol) {
|
||||
symbol.deprecationStatus?.level == DeprecationLevelValue.HIDDEN
|
||||
symbol.getDeprecationStatus(annotationUseSiteTarget)?.level == DeprecationLevelValue.HIDDEN
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+8
@@ -6,11 +6,13 @@
|
||||
package org.jetbrains.kotlin.idea.frontend.api.components
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.Deprecation
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySymbol
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol
|
||||
|
||||
public abstract class KtSymbolInfoProvider : KtAnalysisSessionComponent() {
|
||||
public abstract fun getDeprecation(symbol: KtSymbol): Deprecation?
|
||||
public abstract fun getDeprecation(symbol: KtSymbol, annotationUseSiteTarget: AnnotationUseSiteTarget?): Deprecation?
|
||||
public abstract fun getGetterDeprecation(symbol: KtPropertySymbol): Deprecation?
|
||||
public abstract fun getSetterDeprecation(symbol: KtPropertySymbol): Deprecation?
|
||||
}
|
||||
@@ -21,6 +23,12 @@ public interface KtSymbolInfoProviderMixIn : KtAnalysisSessionMixIn {
|
||||
*/
|
||||
public val KtSymbol.deprecationStatus: Deprecation? get() = analysisSession.symbolInfoProvider.getDeprecation(this)
|
||||
|
||||
/**
|
||||
* Gets the deprecation status of the given symbol. Returns null if the symbol it not deprecated.
|
||||
*/
|
||||
public fun KtSymbol.getDeprecationStatus(annotationUseSiteTarget: AnnotationUseSiteTarget?): Deprecation? =
|
||||
analysisSession.symbolInfoProvider.getDeprecation(this)
|
||||
|
||||
/**
|
||||
* Gets the deprecation status of the getter of this property symbol. Returns null if the getter it not deprecated.
|
||||
*/
|
||||
|
||||
+11
@@ -35,6 +35,17 @@ internal class KtFirSymbolInfoProvider(
|
||||
}
|
||||
}
|
||||
|
||||
override fun getDeprecation(symbol: KtSymbol, annotationUseSiteTarget: AnnotationUseSiteTarget?): Deprecation? {
|
||||
require(symbol is KtFirSymbol<*>)
|
||||
return symbol.firRef.withFir { firDeclaration ->
|
||||
if (annotationUseSiteTarget != null) {
|
||||
firDeclaration.symbol.getDeprecationForCallSite(annotationUseSiteTarget)
|
||||
} else {
|
||||
firDeclaration.symbol.getDeprecationForCallSite()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getGetterDeprecation(symbol: KtPropertySymbol): Deprecation? {
|
||||
require(symbol is KtFirSymbol<*>)
|
||||
return symbol.firRef.withFir {
|
||||
|
||||
Reference in New Issue
Block a user