K2: add stubs for enum entries deprecation diagnostics (KT-59344)
This commit is contained in:
committed by
Space Team
parent
652ff54835
commit
d028f9ec95
+7
@@ -1699,6 +1699,13 @@ object DIAGNOSTICS_LIST : DiagnosticList("FirErrors") {
|
||||
val LABEL by object : DiagnosticGroup("label") {
|
||||
val REDUNDANT_LABEL_WARNING by warning<KtLabelReferenceExpression>(PositioningStrategy.LABEL)
|
||||
}
|
||||
|
||||
val ENUM_ENTRIES_DEPRECATIONS by object : DiagnosticGroup("Enum.entries resolve deprecations") {
|
||||
val DEPRECATED_ACCESS_TO_ENUM_ENTRY_COMPANION_PROPERTY by warning<PsiElement>()
|
||||
val DEPRECATED_ACCESS_TO_ENTRY_PROPERTY_FROM_ENUM by warning<PsiElement>()
|
||||
val DEPRECATED_ACCESS_TO_ENUM_ENTRY_PROPERTY_AS_REFERENCE by warning<PsiElement>()
|
||||
val DEPRECATED_DECLARATION_OF_ENUM_ENTRY by warning<KtEnumEntry>()
|
||||
}
|
||||
}
|
||||
|
||||
private val exposedVisibilityDiagnosticInit: DiagnosticBuilder.() -> Unit = {
|
||||
|
||||
@@ -845,6 +845,12 @@ object FirErrors {
|
||||
// label
|
||||
val REDUNDANT_LABEL_WARNING by warning0<KtLabelReferenceExpression>(SourceElementPositioningStrategies.LABEL)
|
||||
|
||||
// Enum.entries resolve deprecations
|
||||
val DEPRECATED_ACCESS_TO_ENUM_ENTRY_COMPANION_PROPERTY by warning0<PsiElement>()
|
||||
val DEPRECATED_ACCESS_TO_ENTRY_PROPERTY_FROM_ENUM by warning0<PsiElement>()
|
||||
val DEPRECATED_ACCESS_TO_ENUM_ENTRY_PROPERTY_AS_REFERENCE by warning0<PsiElement>()
|
||||
val DEPRECATED_DECLARATION_OF_ENUM_ENTRY by warning0<KtEnumEntry>()
|
||||
|
||||
init {
|
||||
RootDiagnosticRendererFactory.registerFactory(FirErrorsDefaultMessages)
|
||||
}
|
||||
|
||||
+22
@@ -174,7 +174,11 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DELEGATE_USES_EXT
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DELEGATION_IN_INTERFACE
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DELEGATION_NOT_TO_INTERFACE
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DEPRECATED_ACCESS_TO_ENTRY_PROPERTY_FROM_ENUM
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DEPRECATED_ACCESS_TO_ENUM_ENTRY_COMPANION_PROPERTY
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DEPRECATED_ACCESS_TO_ENUM_ENTRY_PROPERTY_AS_REFERENCE
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DEPRECATED_BINARY_MOD
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DEPRECATED_DECLARATION_OF_ENUM_ENTRY
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DEPRECATED_IDENTITY_EQUALS
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DEPRECATED_MODIFIER
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DEPRECATED_MODIFIER_CONTAINING_DECLARATION
|
||||
@@ -2431,6 +2435,24 @@ object FirErrorsDefaultMessages : BaseDiagnosticRendererFactory() {
|
||||
"Label is redundant, because it cannot be referenced in a 'break', 'continue', or 'return' expression."
|
||||
)
|
||||
|
||||
// Enum entries deprecations
|
||||
map.put(
|
||||
DEPRECATED_ACCESS_TO_ENUM_ENTRY_COMPANION_PROPERTY,
|
||||
"Ambiguous access to the enum companion's property 'entries' is deprecated. Please, add the explicit 'Companion' qualifier to the class name."
|
||||
)
|
||||
map.put(
|
||||
DEPRECATED_ACCESS_TO_ENTRY_PROPERTY_FROM_ENUM,
|
||||
"Ambiguous access to the 'entries' property from within the enum is deprecated. Please add the explicit qualifier to the call."
|
||||
)
|
||||
map.put(
|
||||
DEPRECATED_ACCESS_TO_ENUM_ENTRY_PROPERTY_AS_REFERENCE,
|
||||
"Ambiguous access to the 'entries' property is deprecated. Please specify the type of the referenced expression explicitly."
|
||||
)
|
||||
map.put(
|
||||
DEPRECATED_DECLARATION_OF_ENUM_ENTRY,
|
||||
"Conflicting declarations: the enum entry 'entries' and the property 'Enum.entries' (KT-48872). Please rename the enum entry declaration."
|
||||
)
|
||||
|
||||
// Extended checkers group
|
||||
map.put(REDUNDANT_VISIBILITY_MODIFIER, "Redundant visibility modifier.")
|
||||
map.put(REDUNDANT_MODALITY_MODIFIER, "Redundant modality modifier.")
|
||||
|
||||
Reference in New Issue
Block a user