FIR opt-in: rename(s) in checker(s)

This commit is contained in:
Mikhail Glukhikh
2021-09-02 16:27:26 +03:00
committed by TeamCityServer
parent 42abc4a3af
commit 8bb16d8e7a
2 changed files with 6 additions and 6 deletions
@@ -25,10 +25,10 @@ object FirOptInAnnotationCallChecker : FirAnnotationCallChecker() {
override fun check(expression: FirAnnotationCall, context: CheckerContext, reporter: DiagnosticReporter) {
val lookupTag = expression.annotationTypeRef.coneTypeSafe<ConeClassLikeType>()?.lookupTag ?: return
val classId = lookupTag.classId
val isMarker = classId == OptInNames.REQUIRES_OPT_IN_CLASS_ID
val isRequiresOptIn = classId == OptInNames.REQUIRES_OPT_IN_CLASS_ID
val isOptIn = classId == OptInNames.OPT_IN_CLASS_ID
if (isMarker || isOptIn) {
checkUsageOfKotlinExperimentalOrUseExperimental(expression.source, context, reporter)
if (isRequiresOptIn || isOptIn) {
checkOptInIsEnabled(expression.source, context, reporter)
if (isOptIn) {
val arguments = expression.arguments
if (arguments.isEmpty()) {
@@ -52,7 +52,7 @@ object FirOptInAnnotationCallChecker : FirAnnotationCallChecker() {
}
}
private fun checkUsageOfKotlinExperimentalOrUseExperimental(
private fun checkOptInIsEnabled(
element: FirSourceElement?,
context: CheckerContext,
reporter: DiagnosticReporter
@@ -221,10 +221,10 @@ object FirOptInUsageBaseChecker {
}
private fun FirAnnotationContainer.isExperimentalityAcceptable(annotationClassId: ClassId): Boolean {
return getAnnotationByClassId(annotationClassId) != null || isAnnotatedWithUseExperimentalOf(annotationClassId)
return getAnnotationByClassId(annotationClassId) != null || isAnnotatedWithOptIn(annotationClassId)
}
private fun FirAnnotationContainer.isAnnotatedWithUseExperimentalOf(annotationClassId: ClassId): Boolean {
private fun FirAnnotationContainer.isAnnotatedWithOptIn(annotationClassId: ClassId): Boolean {
for (annotation in annotations) {
val coneType = annotation.annotationTypeRef.coneType as? ConeClassLikeType
if (coneType?.lookupTag?.classId != OptInNames.OPT_IN_CLASS_ID) {