[FIR] fix resolve contract violation from scopes

We cannot call lazy resolve to STATUS phase from scopes as scopes may be accessed on a STATUS phase or earlier

^KT-54890
^KTIJ-23587 fixed
This commit is contained in:
Ilya Kirillov
2022-12-28 09:59:12 +01:00
committed by teamcity
parent 0d1e7e83b5
commit 1bbcae5ed2
311 changed files with 108 additions and 347 deletions
@@ -151,7 +151,7 @@ class FirElementSerializer private constructor(
}
fun FirClass.nestedClassifiers(): List<FirClassifierSymbol<*>> {
val scope = defaultType().scope(session, scopeSession, FakeOverrideTypeCalculator.DoNothing) ?: return emptyList()
val scope = defaultType().scope(session, scopeSession, FakeOverrideTypeCalculator.DoNothing, requiredPhase = null) ?: return emptyList()
return buildList {
scope.getClassifierNames().mapNotNullTo(this) { scope.getSingleClassifier(it) }
}
@@ -226,7 +226,7 @@ class FirElementSerializer private constructor(
private fun FirClass.declarations(): List<FirCallableDeclaration> = buildList {
val memberScope =
defaultType().scope(session, scopeSession, FakeOverrideTypeCalculator.DoNothing)
defaultType().scope(session, scopeSession, FakeOverrideTypeCalculator.DoNothing, requiredPhase = null)
?: error("Null scope for $this")
fun addDeclarationIfNeeded(symbol: FirCallableSymbol<*>) {