KT-14353 ClassCastException during offline inspections
#KT-14353 Fixed
This commit is contained in:
+16
-14
@@ -243,21 +243,23 @@ abstract class OperatorReferenceSearcher<TReferenceElement : KtElement>(
|
|||||||
|
|
||||||
if (scope is LocalSearchScope) {
|
if (scope is LocalSearchScope) {
|
||||||
for (element in scope.scope) {
|
for (element in scope.scope) {
|
||||||
runReadAction {
|
if (element is KtElement) {
|
||||||
if (element.isValid) {
|
runReadAction {
|
||||||
val refs = ArrayList<PsiReference>()
|
if (element.isValid) {
|
||||||
val elements = element.collectDescendantsOfType<KtElement> {
|
val refs = ArrayList<PsiReference>()
|
||||||
val ref = extractReference(it) ?: return@collectDescendantsOfType false
|
val elements = element.collectDescendantsOfType<KtElement> {
|
||||||
refs.add(ref)
|
val ref = extractReference(it) ?: return@collectDescendantsOfType false
|
||||||
true
|
refs.add(ref)
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
// resolve all references at once
|
||||||
|
(element.containingFile as KtFile).getResolutionFacade().analyze(elements, BodyResolveMode.PARTIAL)
|
||||||
|
|
||||||
|
refs
|
||||||
|
.filter { it.isReferenceTo(targetDeclaration) }
|
||||||
|
.forEach { consumer.process(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
// resolve all references at once
|
|
||||||
(element.containingFile as KtFile).getResolutionFacade().analyze(elements, BodyResolveMode.PARTIAL)
|
|
||||||
|
|
||||||
refs
|
|
||||||
.filter { it.isReferenceTo(targetDeclaration) }
|
|
||||||
.forEach { consumer.process(it) }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user