FIR IDE: fix IDE exception in presence of non-top-level type alias
Finding type alias doesn't work if it's not top level because the class ID doesn't match. There doesn't seem to be a easy way to make it work so this commit simply makes the IDE tolerate it.
This commit is contained in:
committed by
Mikhail Glukhikh
parent
19708cfa87
commit
6ca005cd70
+2
-2
@@ -124,11 +124,11 @@ private fun KtClassOrObject.findFir(firSymbolProvider: FirSymbolProvider): FirRe
|
||||
}
|
||||
}
|
||||
|
||||
private fun KtTypeAlias.findFir(firSymbolProvider: FirSymbolProvider): FirTypeAlias {
|
||||
private fun KtTypeAlias.findFir(firSymbolProvider: FirSymbolProvider): FirTypeAlias? {
|
||||
val typeAlias = ClassId(containingKtFile.packageFqName, nameAsSafeName)
|
||||
return executeWithoutPCE {
|
||||
// Finding a non-top-level type alias won't work
|
||||
firSymbolProvider.getClassLikeSymbolByFqName(typeAlias)?.fir as? FirTypeAlias
|
||||
?: error("Could not find type alias $typeAlias")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -28,10 +28,11 @@ internal inline fun <T> executeOrReturnDefaultValueOnPCE(defaultValue: T, action
|
||||
defaultValue
|
||||
}
|
||||
|
||||
internal inline fun <T : Any> executeWithoutPCE(crossinline action: () -> T): T {
|
||||
internal inline fun <T> executeWithoutPCE(crossinline action: () -> T): T {
|
||||
var result: T? = null
|
||||
ProgressManager.getInstance().executeNonCancelableSection { result = action() }
|
||||
return result!!
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return result as T
|
||||
}
|
||||
|
||||
internal inline fun <T> Lock.lockWithPCECheck(lockingIntervalMs: Long, action: () -> T): T {
|
||||
|
||||
Reference in New Issue
Block a user