[FIR] Return K2 reference shortener result

This commit sets a list of `KtElement` as the return type of
`ShortenCommand::invokeShortening()`. It allows us to take the result
i.e., shortened PSIs. This can be used, for example, when we want to
run code-format only on the shortened PSI after running the reference
shortener.

^KT-57636 Fixed
This commit is contained in:
Jaebaek Seo
2023-03-23 18:19:51 -07:00
committed by Roman Golyshev
parent f810d435f4
commit 3fbd3d7e20
3 changed files with 13 additions and 8 deletions
@@ -13,7 +13,6 @@ import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
import org.jetbrains.kotlin.analysis.api.symbols.KtCallableSymbol
import org.jetbrains.kotlin.analysis.api.symbols.KtClassLikeSymbol
import org.jetbrains.kotlin.analysis.api.symbols.KtEnumEntrySymbol
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtDotQualifiedExpression
import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.psi.KtFile
@@ -119,7 +118,11 @@ public interface KtReferenceShortenerMixIn : KtAnalysisSessionMixIn {
}
public interface ShortenCommand {
public fun invokeShortening()
/**
* Shortens target elements, adds necessary import, and returns a list of the shortened result elements.
*/
public fun invokeShortening(): List<KtElement>
public val isEmpty: Boolean
public fun getTypesToShorten(): List<SmartPsiElementPointer<KtUserType>>
public fun getQualifiersToShorten(): List<SmartPsiElementPointer<KtDotQualifiedExpression>>