Allow deprecated fix for TYPEALIAS_EXPANSION_DEPRECATION
This commit is contained in:
@@ -394,6 +394,8 @@ class QuickFixRegistrar : QuickFixContributor {
|
||||
|
||||
DEPRECATION.registerFactory(DeprecatedSymbolUsageFix, DeprecatedSymbolUsageInWholeProjectFix, MigrateExternalExtensionFix)
|
||||
DEPRECATION_ERROR.registerFactory(DeprecatedSymbolUsageFix, DeprecatedSymbolUsageInWholeProjectFix, MigrateExternalExtensionFix)
|
||||
TYPEALIAS_EXPANSION_DEPRECATION.registerFactory(DeprecatedSymbolUsageFix, DeprecatedSymbolUsageInWholeProjectFix, MigrateExternalExtensionFix)
|
||||
TYPEALIAS_EXPANSION_DEPRECATION_ERROR.registerFactory(DeprecatedSymbolUsageFix, DeprecatedSymbolUsageInWholeProjectFix, MigrateExternalExtensionFix)
|
||||
PROTECTED_CALL_FROM_PUBLIC_INLINE.registerFactory(ReplaceProtectedToPublishedApiCallFix)
|
||||
|
||||
POSITIONED_VALUE_ARGUMENT_FOR_JAVA_ANNOTATION.registerFactory(ReplaceJavaAnnotationPositionedArgumentsFix)
|
||||
|
||||
+10
-1
@@ -116,7 +116,16 @@ abstract class DeprecatedSymbolUsageFixBase(
|
||||
else -> null
|
||||
} ?: return null
|
||||
|
||||
val descriptor = DiagnosticFactory.cast(deprecatedDiagnostic, Errors.DEPRECATION, Errors.DEPRECATION_ERROR).a
|
||||
val descriptor = when (deprecatedDiagnostic.factory) {
|
||||
Errors.DEPRECATION -> DiagnosticFactory.cast(deprecatedDiagnostic, Errors.DEPRECATION).a
|
||||
Errors.DEPRECATION_ERROR -> DiagnosticFactory.cast(deprecatedDiagnostic, Errors.DEPRECATION_ERROR).a
|
||||
Errors.TYPEALIAS_EXPANSION_DEPRECATION ->
|
||||
DiagnosticFactory.cast(deprecatedDiagnostic, Errors.TYPEALIAS_EXPANSION_DEPRECATION).b
|
||||
Errors.TYPEALIAS_EXPANSION_DEPRECATION_ERROR ->
|
||||
DiagnosticFactory.cast(deprecatedDiagnostic, Errors.TYPEALIAS_EXPANSION_DEPRECATION_ERROR).b
|
||||
else -> throw IllegalStateException("Bad QuickFixRegistrar configuration")
|
||||
}
|
||||
|
||||
val replacement = DeprecatedSymbolUsageFixBase.fetchReplaceWithPattern(descriptor, nameExpression.project) ?: return null
|
||||
return Data(nameExpression, replacement, descriptor)
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// "Replace with 'NewClass(12)'" "true"
|
||||
|
||||
@Deprecated("Use NewClass", replaceWith = ReplaceWith("NewClass"))
|
||||
class OldClass @Deprecated("Use NewClass(12)", replaceWith = ReplaceWith("NewClass(12)")) constructor()
|
||||
class OldClass @Deprecated("Use NewClass(12)", level = DeprecationLevel.ERROR, replaceWith = ReplaceWith("NewClass(12)")) constructor()
|
||||
|
||||
@Deprecated("Use New", replaceWith = ReplaceWith("New"))
|
||||
typealias Old = OldClass
|
||||
|
||||
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
// "Replace with 'NewClass(12)'" "true"
|
||||
|
||||
@Deprecated("Use NewClass", replaceWith = ReplaceWith("NewClass"))
|
||||
class OldClass @Deprecated("Use NewClass(12)", replaceWith = ReplaceWith("NewClass(12)")) constructor()
|
||||
class OldClass @Deprecated("Use NewClass(12)", level = DeprecationLevel.ERROR, replaceWith = ReplaceWith("NewClass(12)")) constructor()
|
||||
|
||||
@Deprecated("Use New", replaceWith = ReplaceWith("New"))
|
||||
typealias Old = OldClass
|
||||
|
||||
Reference in New Issue
Block a user