From 22b0a8d9fb1542b8b6108dc194615aa639fa4ded Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Fri, 3 Mar 2023 14:11:16 +0100 Subject: [PATCH] [FIR] reference shortener should not touch fake sources e.g. implicit types can't be shortened. On the other hand, requesting textRange means building ast which might be slow, especially for compiled code --- .../analysis/api/fir/components/KtFirReferenceShortener.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirReferenceShortener.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirReferenceShortener.kt index e6b6e499468..82049cb91ed 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirReferenceShortener.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirReferenceShortener.kt @@ -368,7 +368,7 @@ private class ElementsToShortenCollector( } private fun processTypeRef(resolvedTypeRef: FirResolvedTypeRef) { - val wholeTypeReference = resolvedTypeRef.psi as? KtTypeReference ?: return + val wholeTypeReference = resolvedTypeRef.realPsi as? KtTypeReference ?: return if (!wholeTypeReference.textRange.intersects(selection)) return val wholeClassifierId = resolvedTypeRef.type.lowerBoundIfFlexible().candidateClassId ?: return