Fixed DeprecatedSymbolUsageFixSpecialTest
This commit is contained in:
+2
-2
@@ -44,12 +44,12 @@ public abstract class DeprecatedSymbolUsageFixBase(
|
||||
|
||||
override fun isAvailable(project: Project, editor: Editor?, file: PsiFile): Boolean {
|
||||
if (!super.isAvailable(project, editor, file)) return false
|
||||
val strategy = UsageReplacementStrategy.build(element, replaceWith)
|
||||
val strategy = UsageReplacementStrategy.build(element, replaceWith, recheckAnnotation = true)
|
||||
return strategy != null && strategy.createReplacer(element) != null
|
||||
}
|
||||
|
||||
final override fun invoke(project: Project, editor: Editor?, file: JetFile) {
|
||||
val strategy = UsageReplacementStrategy.build(element, replaceWith)!!
|
||||
val strategy = UsageReplacementStrategy.build(element, replaceWith, recheckAnnotation = false)!!
|
||||
invoke(strategy, project, editor)
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ interface UsageReplacementStrategy {
|
||||
fun createReplacer(usage: JetSimpleNameExpression): (() -> JetElement)?
|
||||
|
||||
companion object {
|
||||
fun build(element: JetSimpleNameExpression, replaceWith: ReplaceWith): UsageReplacementStrategy? {
|
||||
fun build(element: JetSimpleNameExpression, replaceWith: ReplaceWith, recheckAnnotation: Boolean): UsageReplacementStrategy? {
|
||||
val resolutionFacade = element.getResolutionFacade()
|
||||
val bindingContext = resolutionFacade.analyze(element, BodyResolveMode.PARTIAL)
|
||||
var target = element.mainReference.resolveToDescriptors(bindingContext).singleOrNull() ?: return null
|
||||
@@ -42,7 +42,7 @@ interface UsageReplacementStrategy {
|
||||
}
|
||||
|
||||
// check that ReplaceWith hasn't changed
|
||||
if (replacePatternFromSymbol != replaceWith) return null
|
||||
if (recheckAnnotation && replacePatternFromSymbol != replaceWith) return null
|
||||
|
||||
when (target) {
|
||||
is CallableDescriptor -> {
|
||||
|
||||
Reference in New Issue
Block a user