From 85d7a0f6b164b2876e1d01c706aac464bd0a3433 Mon Sep 17 00:00:00 2001 From: Pavel Kirpichenkov Date: Thu, 13 Feb 2020 19:02:22 +0300 Subject: [PATCH] [IDEA-TESTS] Fix `ReplaceProtectedToPublishedApiCallFix` Register error factory in addition to warning factory --- .../org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt | 1 + .../replaceWith/ReplaceProtectedToPublishedApiCallFix.kt | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt index 41468f6425c..175220b30d4 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt @@ -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) diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/replaceWith/ReplaceProtectedToPublishedApiCallFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/replaceWith/ReplaceProtectedToPublishedApiCallFix.kt index 9576cb0e105..55121bceb1a 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/replaceWith/ReplaceProtectedToPublishedApiCallFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/replaceWith/ReplaceProtectedToPublishedApiCallFix.kt @@ -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