[FIR] Remove useless generic parameter from deprecation utils

This commit is contained in:
Dmitriy Novozhilov
2021-07-09 10:17:55 +03:00
committed by teamcityserver
parent c50fe4e399
commit adc45fd3dd
2 changed files with 8 additions and 8 deletions
@@ -36,13 +36,13 @@ object FirDeprecationChecker : FirBasicExpressionChecker() {
reportDeprecationIfNeeded(expression.source, referencedFir, expression, context, reporter)
}
internal fun <T> reportDeprecationIfNeeded(
internal fun reportDeprecationIfNeeded(
source: FirSourceElement?,
referencedFir: T,
referencedFir: FirAnnotatedDeclaration,
callSite: FirElement?,
context: CheckerContext,
reporter: DiagnosticReporter
) where T : FirAnnotatedDeclaration {
) {
val deprecation = getWorstDeprecation(callSite, referencedFir, context) ?: return
val diagnostic = when (deprecation.level) {
DeprecationLevelValue.ERROR, DeprecationLevelValue.HIDDEN -> FirErrors.DEPRECATION_ERROR
@@ -51,9 +51,9 @@ object FirDeprecationChecker : FirBasicExpressionChecker() {
reporter.reportOn(source, diagnostic, referencedFir.symbol, deprecation.message ?: "", context)
}
private fun <T : FirAnnotatedDeclaration> getWorstDeprecation(
private fun getWorstDeprecation(
callSite: FirElement?,
fir: T,
fir: FirAnnotatedDeclaration,
context: CheckerContext
): Deprecation? {
val deprecationInfos = listOfNotNull(
@@ -65,4 +65,4 @@ object FirDeprecationChecker : FirBasicExpressionChecker() {
return deprecationInfos.maxOrNull()
}
}
}
@@ -26,7 +26,7 @@ private val LEVEL_NAME = Name.identifier("level")
private val JAVA_ORIGINS = setOf(FirDeclarationOrigin.Java, FirDeclarationOrigin.Enhancement)
fun <T : FirAnnotatedDeclaration> T.getDeprecation(callSite: FirElement?): Deprecation? {
fun FirAnnotatedDeclaration.getDeprecation(callSite: FirElement?): Deprecation? {
val deprecationInfos = mutableListOf<Deprecation>()
when (this) {
is FirProperty ->
@@ -75,7 +75,7 @@ fun List<FirAnnotationCall>.getDeprecationInfosFromAnnotations(currentVersion: A
return DeprecationsPerUseSite.fromMap(deprecationByUseSite)
}
private fun <T : FirAnnotatedDeclaration> T.getDeprecationForCallSite(
private fun FirAnnotatedDeclaration.getDeprecationForCallSite(
vararg sites: AnnotationUseSiteTarget
): Deprecation? {
val deprecations = when (this) {