[IDEA-TESTS] Fix ReplaceProtectedToPublishedApiCallFix

Register error factory in addition to warning factory
This commit is contained in:
Pavel Kirpichenkov
2020-02-13 19:02:22 +03:00
parent 05b00a1302
commit 85d7a0f6b1
2 changed files with 4 additions and 1 deletions
@@ -450,6 +450,7 @@ class QuickFixRegistrar : QuickFixContributor {
MigrateExternalExtensionFix
)
PROTECTED_CALL_FROM_PUBLIC_INLINE.registerFactory(ReplaceProtectedToPublishedApiCallFix)
PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR.registerFactory(ReplaceProtectedToPublishedApiCallFix)
POSITIONED_VALUE_ARGUMENT_FOR_JAVA_ANNOTATION.registerFactory(ReplaceJavaAnnotationPositionedArgumentsFix)
@@ -90,7 +90,9 @@ class ReplaceProtectedToPublishedApiCallFix(
override fun createAction(diagnostic: Diagnostic): IntentionAction? {
val psiElement = diagnostic.psiElement as? KtExpression ?: return null
val descriptor = DiagnosticFactory.cast(diagnostic, Errors.PROTECTED_CALL_FROM_PUBLIC_INLINE).a.let {
val descriptor = DiagnosticFactory.cast(
diagnostic, Errors.PROTECTED_CALL_FROM_PUBLIC_INLINE, Errors.PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR
).a.let {
if (it is CallableMemberDescriptor) DescriptorUtils.getDirectMember(it) else it
}
val isProperty = descriptor is PropertyDescriptor