FIR IDE: do not resolve declarations if they are already resolved when we are inside lock

This commit is contained in:
Ilya Kirillov
2020-09-09 12:49:22 +03:00
parent fc64d8d5e8
commit 8bcba00bb7
2 changed files with 2 additions and 1 deletions
@@ -45,7 +45,7 @@ internal class FirFileBuilder(
val firFile = buildRawFirFileWithCaching(ktFile, cache)
if (toPhase > FirResolvePhase.RAW_FIR) {
cache.firFileLockProvider.withLock(firFile) {
//add lock for implit type resolve phase & super type
if (firFile.resolvePhase >= toPhase) return@withLock
runResolveWithoutLock(firFile, fromPhase = firFile.resolvePhase, toPhase = toPhase, checkPCE = checkPCE)
}
}
@@ -75,6 +75,7 @@ internal class FirLazyDeclarationResolver(
towerDataContextCollector: FirTowerDataContextCollector? = null,
checkPCE: Boolean
) {
if (firDeclarationToResolve.resolvePhase >= toPhase) return
val nonLazyPhase = minOf(toPhase, FirResolvePhase.DECLARATIONS)
if (firDeclarationToResolve.resolvePhase < nonLazyPhase) {
firFileBuilder.runResolveWithoutLock(