[FIR] Get rid of `ensureResolvedForCalls` completely The problem that this function has been solving (resolving declarations to a somewhat adequate resolve phase) should be solved in another place; moreover, right now it is the only scope that uses that function, which is non-consistent
diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/transformers/PhaseUtils.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/transformers/PhaseUtils.kt index aa206f0..878ea38 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/transformers/PhaseUtils.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/transformers/PhaseUtils.kt
@@ -9,33 +9,12 @@ import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.fir.resolve.fullyExpandedType import org.jetbrains.kotlin.fir.resolve.toSymbol -import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol import org.jetbrains.kotlin.fir.symbols.ensureResolved import org.jetbrains.kotlin.fir.types.ConeClassLikeType import org.jetbrains.kotlin.fir.types.ConeKotlinType import org.jetbrains.kotlin.fir.types.FirTypeRef import org.jetbrains.kotlin.fir.types.coneTypeSafe -fun FirBasedSymbol<*>.ensureResolvedForCalls() { - if (fir.resolvePhase >= FirResolvePhase.DECLARATIONS) return - -// val requiredPhase = when (fir) { -// is FirFunction, is FirProperty -> FirResolvePhase.CONTRACTS -// else -> FirResolvePhase.STATUS -// } -// -// if (requiredPhase == FirResolvePhase.CONTRACTS) { -// // Workaround for recursive contracts in CLI -// // Otherwise the assertion about presence of fir.session.phaseManager would fail -// // See org.jetbrains.kotlin.fir.FirOldFrontendDiagnosticsTestWithStdlibGenerated.Contracts.Dsl.Errors.testRecursiveContract -// if (fir.session.phaseManager == null) return -// } - - val requiredPhase = FirResolvePhase.DECLARATIONS - - ensureResolved(requiredPhase) -} - fun ConeKotlinType.ensureResolvedTypeDeclaration( useSiteSession: FirSession, requiredPhase: FirResolvePhase = FirResolvePhase.DECLARATIONS,
diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirAbstractImportingScope.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirAbstractImportingScope.kt index e028507..98d25bf 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirAbstractImportingScope.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirAbstractImportingScope.kt
@@ -11,7 +11,6 @@ import org.jetbrains.kotlin.fir.declarations.utils.expandedConeType import org.jetbrains.kotlin.fir.resolve.ScopeSession import org.jetbrains.kotlin.fir.resolve.toSymbol -import org.jetbrains.kotlin.fir.resolve.transformers.ensureResolvedForCalls import org.jetbrains.kotlin.fir.scopes.FirContainingNamesAwareScope import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope import org.jetbrains.kotlin.fir.symbols.impl.* @@ -67,7 +66,6 @@ staticsScope.processFunctionsByName(importedName, processor) } else if (importedName.isSpecial || importedName.identifier.isNotEmpty()) { for (symbol in provider.getTopLevelFunctionSymbols(import.packageFqName, importedName)) { - symbol.ensureResolvedForCalls() processor(symbol) } } @@ -83,7 +81,6 @@ staticsScope.processPropertiesByName(importedName, processor) } else if (importedName.isSpecial || importedName.identifier.isNotEmpty()) { for (symbol in provider.getTopLevelPropertySymbols(import.packageFqName, importedName)) { - symbol.ensureResolvedForCalls() processor(symbol) } }