[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) reportDeprecationIfNeeded(expression.source, referencedFir, expression, context, reporter)
} }
internal fun <T> reportDeprecationIfNeeded( internal fun reportDeprecationIfNeeded(
source: FirSourceElement?, source: FirSourceElement?,
referencedFir: T, referencedFir: FirAnnotatedDeclaration,
callSite: FirElement?, callSite: FirElement?,
context: CheckerContext, context: CheckerContext,
reporter: DiagnosticReporter reporter: DiagnosticReporter
) where T : FirAnnotatedDeclaration { ) {
val deprecation = getWorstDeprecation(callSite, referencedFir, context) ?: return val deprecation = getWorstDeprecation(callSite, referencedFir, context) ?: return
val diagnostic = when (deprecation.level) { val diagnostic = when (deprecation.level) {
DeprecationLevelValue.ERROR, DeprecationLevelValue.HIDDEN -> FirErrors.DEPRECATION_ERROR DeprecationLevelValue.ERROR, DeprecationLevelValue.HIDDEN -> FirErrors.DEPRECATION_ERROR
@@ -51,9 +51,9 @@ object FirDeprecationChecker : FirBasicExpressionChecker() {
reporter.reportOn(source, diagnostic, referencedFir.symbol, deprecation.message ?: "", context) reporter.reportOn(source, diagnostic, referencedFir.symbol, deprecation.message ?: "", context)
} }
private fun <T : FirAnnotatedDeclaration> getWorstDeprecation( private fun getWorstDeprecation(
callSite: FirElement?, callSite: FirElement?,
fir: T, fir: FirAnnotatedDeclaration,
context: CheckerContext context: CheckerContext
): Deprecation? { ): Deprecation? {
val deprecationInfos = listOfNotNull( val deprecationInfos = listOfNotNull(
@@ -65,4 +65,4 @@ object FirDeprecationChecker : FirBasicExpressionChecker() {
return deprecationInfos.maxOrNull() return deprecationInfos.maxOrNull()
} }
} }
@@ -26,7 +26,7 @@ private val LEVEL_NAME = Name.identifier("level")
private val JAVA_ORIGINS = setOf(FirDeclarationOrigin.Java, FirDeclarationOrigin.Enhancement) 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>() val deprecationInfos = mutableListOf<Deprecation>()
when (this) { when (this) {
is FirProperty -> is FirProperty ->
@@ -75,7 +75,7 @@ fun List<FirAnnotationCall>.getDeprecationInfosFromAnnotations(currentVersion: A
return DeprecationsPerUseSite.fromMap(deprecationByUseSite) return DeprecationsPerUseSite.fromMap(deprecationByUseSite)
} }
private fun <T : FirAnnotatedDeclaration> T.getDeprecationForCallSite( private fun FirAnnotatedDeclaration.getDeprecationForCallSite(
vararg sites: AnnotationUseSiteTarget vararg sites: AnnotationUseSiteTarget
): Deprecation? { ): Deprecation? {
val deprecations = when (this) { val deprecations = when (this) {