FIR IDE: fix deadlock in override check
We should not call withFir nestedly as resolving in read action causing deadlocks
This commit is contained in:
+4
-6
@@ -43,12 +43,10 @@ internal class KtFirSymbolDeclarationOverridesProvider(
|
||||
check(callableSymbol is KtFirSymbol<*>)
|
||||
check(containingDeclaration is KtFirClassOrObjectSymbol)
|
||||
|
||||
return callableSymbol.firRef.withFir(FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE) { firCallableElement ->
|
||||
|
||||
containingDeclaration.firRef.withFir(FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE) { containingDeclaration ->
|
||||
|
||||
val firTypeScope = containingDeclaration.unsubstitutedScope(
|
||||
containingDeclaration.session,
|
||||
return containingDeclaration.firRef.withFir(FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE) { firContainer ->
|
||||
callableSymbol.firRef.withFirUnsafe { firCallableElement ->
|
||||
val firTypeScope = firContainer.unsubstitutedScope(
|
||||
firContainer.session,
|
||||
ScopeSession(),
|
||||
withForcedTypeCalculator = false
|
||||
)
|
||||
|
||||
+12
@@ -41,6 +41,18 @@ internal class FirRefWithValidityCheck<out D : FirDeclaration>(fir: D, resolveSt
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs [action] with fir element *without* any lock hold
|
||||
* Consider using this only when you are completely sure
|
||||
* that fir or one of it's container already holds the lock (i.e, corresponding withFir call was made)
|
||||
*/
|
||||
inline fun <R> withFirUnsafe(action: (fir: D) -> R): R {
|
||||
token.assertIsValidAndAccessible()
|
||||
val fir = firWeakRef.get()
|
||||
?: throw EntityWasGarbageCollectedException("FirElement")
|
||||
return action(fir)
|
||||
}
|
||||
|
||||
val resolveState
|
||||
get() = resolveStateWeakRef.get() ?: throw EntityWasGarbageCollectedException("FirModuleResolveState")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user