[LL FIR] do not update phase if exception occurred

Exception (even PCE) can lead to inconsistent situations, for example,
where a function can be marked as resolved, but arguments – not.
Also, in this case, it is possible that the function will be
marked as resolved to TYPES, but not all its type really resolved

^KTIJ-25582 Fixed
This commit is contained in:
Dmitrii Gridin
2023-05-19 17:16:22 +02:00
committed by Space Team
parent 1749bafc30
commit 447e1711da
@@ -171,10 +171,15 @@ internal class LLFirLockProvider(private val checker: LLFirLazyResolveContractCh
is FirResolvedToPhaseState -> {
if (!tryLock(toPhase, stateSnapshot)) continue
var exceptionOccurred = false
try {
action()
} catch (e: Throwable) {
exceptionOccurred = true
throw e
} finally {
val newPhase = if (updatePhase) toPhase else stateSnapshot.resolvePhase
val newPhase = if (updatePhase && !exceptionOccurred) toPhase else stateSnapshot.resolvePhase
unlock(toPhase = newPhase)
}